I am trying to deploy the following stack in portainer
---
version: "3.8"
services:
dashy:
# To build from source, replace 'image: lissy93/dashy' with 'build: .'
# build: .
image: lissy93/dashy
container_name: Dashy
# Pass in your config file below, by specifying the path on your host machine
volumes:
- ~/dashy/my-conf.yml:/app/public/conf.yml
ports:
- 4000:80
# Set any environmental variables
environment:
- NODE_ENV=production
# Specify your user ID and group ID. You can find this by running `id -u` and `id -g`
# - UID=1000
# - GID=1000
# Specify restart policy
restart: unless-stopped
# Configure healthchecks
healthcheck:
test: ['CMD', 'node', '/app/services/healthcheck']
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
But I get the following error
failed to deploy a stack: Network my_dashy_default
Creating Network my_dashy_default
Created Container Dashy
Creating Container Dashy
Created Container Dashy
Starting Error response from daemon:
failed to create shim task:
OCI runtime create failed:
runc create failed:
unable to start container process:
error during container init:
error mounting "/dashy/my-conf.yml" to rootfs at "/app/public/conf.yml":
mount /dashy/my-conf.yml:/app/public/conf.yml (via /proc/self/fd/6), flags: 0x5000: 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
I don’t begin to understand how this all works but if I change the volumes part as follows (incorrect conf file name on host), the instance starts, It’s obviously not correct but dashy starts up.
You changed the filename in the container, not on the host. That’s why it worked. The left side is the path on the host and the right side is the path in the container.
The error message mentiones:
error mounting "/dashy/my-conf.yml"
without the tilde character at the beginning which indicates that user’s home is the system root. Unless you removed the original home from the error message. Maybe you are trying to run Docker with a different user so the file does exist ibut not where Docker is looking for it. When compose try to mount a nonexistent file it will create it as a folder and mounts that. At least when you use the short syntax not the long syntax. So you tried to mount a folder onto a file exactly as the error message says. Then you changed the path in the container so you mounted a folder in the container at a location where no file or folder existed so it worked.
---
version: "3.8"
services:
dashy:
# To build from source, replace 'image: lissy93/dashy' with 'build: .'
# build: .
image: lissy93/dashy
container_name: Dashy
# Pass in your config file below, by specifying the path on your host machine
volumes:
- ~/dashy/my-conf.yml:/app/public/onf.yml
ports:
- 4000:80
# Set any environmental variables
environment:
- NODE_ENV=production
# Specify your user ID and group ID. You can find this by running `id -u` and `id -g`
# - UID=1000
# - GID=1000
# Specify restart policy
restart: unless-stopped
# Configure healthchecks
healthcheck:
test: ['CMD', 'node', '/app/services/healthcheck']
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
Regarding the my-conf.yml file I tried with the file, without the file; basically many different permutations and none worked.
I have another on the same machine and using the tidel works although this time it is mapping a folder to a folder.
I have check and ~/remotely/var/www has the same permissions and ownership as ~/dashy so if Docker can see one it should see the other too. Unless in that case even though it runs, maybe the mapping is not working; not sure.
Having said all that @rimelek your explanation makes sense i.e. Docker cannot see the file that I am referring to. I will sleep on things and take another look tomorrow.
Without what the content of those host folders is I can’t be sure you see the folder that is mounted to the container or just a folder witha the same name somewhere else. The only way to makes ure you see the right folder is to write something to that folder on the host and check it in the container to see if it is there. Or create a new file in the container and see if it eppears on the host.
Suddenly Dashy stopped working. I tried recreating and it returned to the same issue above. Googling seems to indicate that a number of people have this issue.
I think I will move onto another Dashboard but thanks for assisting thus far.