Docker compose up error: container-linux.go: 348 - docker

When I typed "docker-compose up", I got this error:
Starting elasticsearch-1 ... error
ERROR: for elasticsearch-1 Cannot start service elasticsearch-1:
b'OCI runtime create failed: container_linux.go:348: starting
container process caused "process_linux.go:402: container init caused
\"rootfs_linux.go:58: mounting
\\\"/c/Users/user/Desktop/data/elasticsearch.yml\\\" to rootfs
\\\"/mnt/sda1/var/lib/docker/aufs/mnt/3ec70a7ad26a47f6537aed2ac091eb2507dfb4de983183b0e669832229f948d7\\\"
at
\\\"/mnt/sda1/var/lib/docker/aufs/mnt/3ec70a7ad26a47f6537aed2ac091eb2507dfb4de983183b0e669832229f948d7/usr/share/elasticsearch/config/elasticsearch.yml\\\"
caused \\\"not a directory\\\"\"": unknown: Are you trying to
mount a directory onto a file (or vice-versa)? Check if the specified
host path exists and is the expected type'
Docker-compose.yml contains the following:
From: http://blog.sandeepchivukula.com
elasticsearch-1:
image: elasticsearch
container_name: elasticsearch-1
ports:
- "9200:9200"
- "9300:9300"
volumes:
- ./data/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
command: elasticsearch
kibana-frontend:
image: kibana:latest
container_name: kibana-frontend
ports:
- "5601:5601"
links:
- elasticsearch-1:elasticsearch
Could you please help me solve this error?
Any help will be appreciated
Thank you in advance

I had the same problem today, and I found the solution for my case in this GitHub Thread:
Cause: I had to change my Windows password today
Solution: The error stopped after going into Docker settings -> Shared Drives, un-selecting my drive (+ Apply), restarting Docker app and then re-selecting (+ Apply).
Kudos to danielcgithub!

Clone (or download the ZIP) of the whole project from GIT and start the docker inside the project folder:
#git clone https://github.com/sandeep/photosearch/?utm_source=sandeepchivukula.com&utm_medium=blog&utm_campaign=photosearch
#cd photosearch
#docker compose up

You can not bind a volume on a single file.
Either you bind the entire directory:
elasticsearch-1:
image: elasticsearch
container_name: elasticsearch-1
ports:
- "9200:9200"
- "9300:9300"
volumes:
- ./data/:/usr/share/elasticsearch/config/
command: elasticsearch
Or you can use docker configs (see further documentation here):
elasticsearch-1:
image: elasticsearch
container_name: elasticsearch-1
ports:
- "9200:9200"
- "9300:9300"
configs:
- source: elasticsearch_config
target: /usr/share/elasticsearch/config/elasticsearch.yml
command: elasticsearch
configs:
elasticsearch_config:
file: ./data/elasticsearch.yml

Related

Docker-Compose Failed to register symlink

I´m trying to run an docker-compose file. But I always get the error message:
failed to register layer: symlink
../118db2348300daaa2443c22d8bd790d2985a25b5e42f49404e9f3b4333e776dd/diff/mnt/usb1/docker/fuse-overlayfs/l/NLEONPNG5QHTMTGHCWRQLIQ2DG: operation not permitted
It has something to do with the storage driver fuse-overlayfs which I use because I changed the data-root to my external HDD with vfat format.
Any hints?
Edit 1: The docker-compose file in question:
prometheus:
image: ajeetraina/prometheus-armv7
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- "-config.file=/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"
grafana:
image: fg2it/grafana-armhf:v3.1.1
ports:
- "3000:3000"
The Fat file system does not support symlink, reformatting the HDD to ext4 solved the problem.

Do I need to create my own nginx.conf file to run this docker-composer.yml file succesfully?

I am trying to get a nextcloud + mariadb + nginx docker-compose up and running locally, but I am stuck when it comes to the nginx.conf file. I am following this guide at the base-fpm section. Here is the docker-compose.yml file, what I ran in my CLI and the error i got:
version: '2'
volumes:
nextcloud:
db:
services:
db:
image: mariadb
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mypw
- MYSQL_PASSWORD=mypw
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud:fpm
restart: always
links:
- db
volumes:
- nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD=mypw
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
web:
image: nginx
restart: always
ports:
- 8080:80
links:
- app
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
volumes_from:
- app
$ docker-compose up
Creating network "nextcloud_default" with the default driver
Creating volume "nextcloud_nextcloud" with default driver
Creating volume "nextcloud_db" with default driver
Creating nextcloud_db_1 ... done
Creating nextcloud_app_1 ... done
Creating nextcloud_web_1 ... error
ERROR: for nextcloud_web_1 Cannot start service web: OCI runtime create failed:
container_linux.go:370: starting container process caused: process_linux.go:459: container init
caused: rootfs_linux.go:59: mounting "/home/nowak/docker/nextcloud/nginx.conf" to rootfs at
"/var/lib/docker/overlay2/4869db7f0302ec8b7e5f4328b861e64627daa78728d443913052cecd1cd095a9/merge
d/etc/nginx/nginx.conf" caused: not a directory: unknown: Are you trying to mount a directory
onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:370:
starting container process caused: process_linux.go:459: container init caused:
rootfs_linux.go:59: mounting "/home/nowak/docker/nextcloud/nginx.conf" to rootfs at
"/var/lib/docker/overlay2/4869db7f0302ec8b7e5f4328b861e64627daa78728d443913052cecd1cd095a9/merge
d/etc/nginx/nginx.conf" caused: not a directory: unknown: Are you trying to mount a directory
onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
Do I need to create a nginx.conf file and place it in my work directory?
The guide does mention this:
The configuration for nginx is stored in the configuration file nginx.conf, that is mounted into the container. An example can be found in the examples section here.
But when I follow that link, I can't seem to find any example of nginx.conf files.
Looks like other people are also searching for the file, so I'll add the link from my comment to the right file here:
https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf

Docker mounting rootfs caused not a directory error

I've been trying docker-compose up -d to my container but causes this error below:
ERROR: for phpsample-feed_phpsample_1 Cannot start service phpsample: OCI runtime create failed:
container_linux.go:346: starting container process caused "process_linux.go:449: container init caused
\"rootfs_linux.go:58: mounting \\"/c/Users/testUser/Documents/phpsample-feed/src\\" to rootfs
\\"/mnt/sda1/var/lib/docker/overlay2/e6bf66b01f587c8826c2944b676044c6a199a0c8c2b8807adf13de0e0f8c4509/
merged\\" at \\"/mnt/sda1/var/lib/docker/overlay2/e6bf66b01f587c8826c2944b676044c6a199a0c8c2b8807adf13de0e0f8c4509/
merged/var/www/html\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory
onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Here is my docker-compose.yml file:
version: '3.7'
services:
phpsample:
build:
context: .
init: true
ports:
- '8080:80'
depends_on:
- db
- redis
volumes:
- ./src:/var/www/html:rw
environment:
- DB_HOST=db
- DB_USR=user
- DB_PW=test
- DB_DBNAME=phpsample
- DB_DBPREFIX=dev_
- IS_SHORT_URL=1
- CACHE_DRIVER=redis
- CACHE_HOST=redis
- CACHE_PORT=6379
- CACHE_REDIS_DB=3
- DEBUG=false
restart: always
db:
image: mysql:8
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_USER=user
- MYSQL_PASSWORD=test
- MYSQL_DATABASE=phpsample
volumes:
- db_data:/var/lib/msyql
command: --default-authentication-plugin=mysql_native_password --sql_mode=NO_ENGINE_SUBSTITUTION
redis:
image: redis:5-buster
init: true
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis_data:/data
volumes:
db_data:
redis_data:
My system and tools used:
Windows 10 Home
Docker Toolbox Terminal
Kitematic
Oracle VM
I've also tried editing my Shared Folders on VM by doing this. With the settings below:
Name: c/Users Path: C:\Users
src should be a directory containing your web content, not a file.
In docker-compose.yaml file make sure that input yaml file path is exist under volumes:

Docker unable to mount nginx

I'm having issues setting up Docker for the first time on a Windows using the Docker Toolbox. Everything works except nginx at the moment.
Error message:
ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/c/wamp64/www/cathaypacific_career/ops/nginx/default.conf\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/aufs/mnt/ff9b27a89b26b0e9091264d04d3a475f18469db3cf3be473c005e2d4c7d4b5ef\\\" at \\\"/mnt/sda1/var/lib/docker/aufs/mnt/ff9b27a89b26b0e9091264d04d3a475f18469db3cf3be473c005e2d4c7d4b5ef/etc/nginx/conf.d/default.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
Docker-compose config:
version: '3'
services:
web:
container_name: web
image: nginx:1.13.3-alpine
networks:
- web_tier
ports:
- 80:80
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ../:/code
- /code/ops/
depends_on:
- app
app:
container_name: app
build: ./php/
networks:
- web_tier
- app_tier
expose:
- '9000'
volumes:
- ./php/settings.conf:/usr/local/etc/php-fpm.d/settings.conf
- ../:/code
- /code/ops/
working_dir: /code
entrypoint: "/bin/sh -c"
command:
- "php-fpm"
env_file: ../.env
depends_on:
- db
db:
container_name: db
image: mysql:5.6.39
networks:
- app_tier
- db_tier
expose:
- '3306'
ports:
- 3306:3306
volumes:
- db_data:/var/lib/mysql
- ./db:/etc/mysql/conf.d
restart: always
env_file: ../.env
networks:
web_tier:
driver: bridge
app_tier:
driver: bridge
db_tier:
driver: bridge
volumes:
db_data:
The issue seems to be related to Nginx with the default.conf not being accessible or the app thinkgs it's a folder and not a file.
I checked the issue online and people suggests to mount the C: folder so I tried to mount it on Oracle VirtualBox and re-run the docker-compose up command but it didn't solve the issue.
Any idea?
I solved same problem with sharing folder with Oracle VirtualBox VM default
Share your project folder and restart your vm.
You can do even with command like
docker-machine stop default & docker-machine stop default
Now, you need to use shared name (project) instead of . in your compose file (docker-compose.yml)
For your case,
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
should changed to
- /sharename/nginx/default.conf:/etc/nginx/conf.d/default.conf
Now try with docker-compose up.
It worked for me.

Mounting volumes before executing commands with docker-compose and boot2docker

I'm using OSX and I have installed Kitematic which uses boot2docker to run docker and containers. I have created a container which needs to mount some local folder under docker folder and doing that with docker-compose:
web:
build: .
ports:
- "9001:9001"
- "9002:9002"
volumes:
- /projects/test /somepath
- /projects/test2 /someotherpath
command: ant clean all;./server.sh start
when I run docker-compose up it seems that the volume are not mounted before executing the command phase cause I am getting error logs that /somepathand /someotherpath cannot be found.
I do not understand what is wrong with docker-command configuration.
I think you need to replace the space with a colon when mapping volumes. For example:
kafka:
image: wurstmeister/kafka:0.8.2.1
hostname: kafka
ports:
- "9092:9092"
links:
- zookeeper:zk
environment:
KAFKA_ADVERTISED_HOST_NAME: kafka
KAFKA_ADVERTISED_PORT: 9092
volumes:
- /var/run/docker.sock:/var/run/docker.sock

Resources