A
A
Andrey Sobolev2020-01-30 15:53:55
Docker
Andrey Sobolev, 2020-01-30 15:53:55

What's the docker error?

ERROR: for cenergy_mysql_1  Cannot start service mysql: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/etc/localtime\\\" to rootfs \\\"/var/lib/do
cker/overlay2/b2fc4e93fb6a984da426bf602cc593f20fc1b9694a0dbb08c6bdd2144d63b825/merged\\\" at \\\"/var/lib/docker/overlay2/b2fc4e93fb6a984da426bf602cc593f20fc1b9694a0dbb08c6bdd2144d63b825/merged/usr/share/zoneinfo/UCT\\\" 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


I'm trying to start a container. Looks like a beard

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Georg Gaal, 2020-02-02
@andrufka46rus

well, everything is written - when you mount, you can only mount a file on a file or a directory on a directory. Sometimes it happens that if the volume on the left contains a file that does not exist on the host, then the docker goes crazy. And creates a directory with root:root rights instead.
What could be the solution? To begin with, stop using the simplified -v syntax in docker run or volumes in docker-compose, and use the extended mount syntax (which is with --mount). Then, if the host does not have the required file, then the docker container will not STUPIDLY start and there will be a clear error message like:

docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /home/local/georg.gaal/formulas.
See 'docker run --help'.

At the same time, you also get the bonus that the docker will not try to change the rights to the directory. And the files created inside will be with the rights that are set inside the container - sheer nonsense. The downside is that all the necessary directories and files to run the container must be created in advance. Those. colleagues should already be given a docker compose file plus a bash script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question