Docker-Compose Failed to register symlink - docker

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.

Related

Grafana on Docker

I am using docker to run prometheus, grafana and node exporter. I am trying to use named volumes and I am having some issues with that. My docker-compose code is:
version: "3.7"
volumes:
grafana_ini:
prometheus_data:
grafana_data:
dashboards_data:
services:
grafana:
build: ./grafana
volumes:
- grafana_ini:/etc/grafana/grafana.ini
- grafana_data:/etc/grafana/provisioning/datasources/datasource.yml
- dashboards_data:/etc/grafana/provisioning/dashboards
- ./dashboards/linux_dashboard.json:/etc/grafana/provisioning/dashboards/linux_dashboard.json
ports:
- 3000:3000
links:
- prometheus
prometheus:
build: ./prometheus
volumes:
- prometheus_data:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
node-exporter:
image: prom/node-exporter:latest
container_name: node_exporter
restart: unless-stopped
expose:
- 9100
and my dockerfile for grafana is:
FROM grafana/grafana:latest
COPY ./Ini/grafana.ini /etc/grafana/grafana.ini
COPY datasource.yml /etc/grafana/provisioning/datasources/datasource.yml
COPY ./dashboards/dashboard.yml /etc/grafana/provisioning/dashboards
COPY ./dashboards/server/linux_dashboard.json /etc/grafana/provisioning/dashboards
COPY ./dashboards/server/windows_dashboard.json /etc/grafana/provisioning/dashboards
EXPOSE 3000:3000
and I am getting this error while building it
ERROR: for 2022_grafana_1 Cannot create container for service grafana: source /var/lib/docker/overlay2/4ac5b487fd7fd52491b250c4afaa433801420cd907ac4a70ddb4589fdb99368b/merged/etc/grafana/grafana.ini is not directory
ERROR: for grafana Cannot create container for service grafana: source /var/lib/docker/overlay2/4ac5b487fd7fd52491b250c4afaa433801420cd907ac4a70ddb4589fdb99368b/merged/etc/grafana/grafana.ini is not directory
Can anybody please help me.
It looks like there are some problems with the volume configuration in your Grafana container:
First, I think this was simply a typo in your question:
- grafana_ini:/etc/grafana/grafana.inianticipated location in container
I suspect that you were actually intending this:
- grafana_ini:/etc/grafana/grafana.ini
Which doesn't make any sense: grafana.ini is a file, but a volume is
a directory. Docker won't allow you to mount a directory on top of a
file, hence the error:
ERROR: .../etc/grafana/grafana.ini is not directory
You have the same problem with the grafana_data volume, which you're
attempting to mount on top of datasource.yml:
- grafana_data:/etc/grafana/provisioning/datasources/datasource.yml
I think you may be approaching this configuration in the wrong way;
you may want to read through these documents:
https://grafana.com/docs/grafana/latest/installation/docker/
https://grafana.com/docs/grafana/latest/administration/configure-docker/
https://grafana.com/docs/grafana/latest/administration/provisioning/
It is possible to configure Grafana (and Prometheus!) using only bind
mounts and environment variables (this includes installing plugin,
data sources, and dashboards), so you don't need to build your own
custom images.
Unrelated to this particular problem, there are some other things in
your docker-compose.yml that are worth changing. You should no
longer be using the links directive...
links:
- prometheus
...because Docker maintains DNS for you automatically; your containers
can refer to each other by name with no additional configuration.

docker cannot create directory

this is my docker compose yml file
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
restart: unless-stopped
ports:
- 3306:3306
environment:
- MARIADB_ROOT_USER=root
- MARIADB_ROOT_PASSWORD=root
- MARIADB_DATABASE=DB
- MARIADB_USER=user
- MARIADB_PASSWORD=pass!
- MARIADB_CHARACTER_SET=utf8
- MARIADB_COLLATE=utf8_general_ci
volumes:
- /Users/joachim/project/docker/mariadb/:/bitnami/mariadb
Im getting this error
mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied
How might i solve this?
Since you're using Windows, I assume, that you're using MinGW as your bash environment (your path is UNIX-line path). To access your drive C you need to add /c at the beginning of your path.
So, your mount path will be equal to this path
/c/Users/joachim/project/docker/mariadb/

docker volume create - set permissions

I'm running this on debian 9
I'm using sudo docker volume create db to create a volume I'm using in my docker-compose.yml. But I still get the error db_1_d89b59353579 | mkdir: cannot create directory '/var/lib/mysql': Permission denied.
How can I set permissions for the user using that volume. And how to get the user?
Docker-Compose:
version: '2'
volumes:
nextcloud:
db:
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- db:/var/lib/mysql:z
environment:
- MYSQL_ROOT_PASSWORD=***
- MYSQL_PASSWORD=***
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud
ports:
- 8080:80
links:
- db
volumes:
- nextcloud:/var/www/html
restart: always
I got an install.sh file where I run:
...
sudo docker volume create db
sudo docker-compose build
docker-compose up -d
Try to first change the mounts to local folders and see if that fixes your issue:
version: '2'
volumes:
nextcloud:
db:
services:
db:
...
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=***
- MYSQL_PASSWORD=***
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
...
volumes:
- ./nextcloud:/var/www/html
restart: always
If that does then check that the volumes are correctly removed by docker-compose down. Run docker volume ls. If they still persist then remove them by hand and rerun your containers with the volumes.
Regarding the difference between mounting to a volume (db:/var/lib/mysql) and mounting to a host path (./db:/var/lib/mysql):
In the first case it is a volume managed by Docker. It is meant for persistence but getting to the files is a bit more tricky. In the second case it is a path on the host and it makes it a lot easier to retrieve persisted files. I recommend to run "docker-compose config" for both situations and see the difference in how docker-compose internally transforms the statement.

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

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

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.

Resources