docker container start with
- /var/run/docker.sock:/var/run/docker.sock
Inside docker container i want to call another docker something like this
docker run --rm --net none -v /new/test.py:/new/test.py test-python timeout 5 make --silent -C /new/ test
but i get an error
docker: Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting to rootfs 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.
Without the -v parameter, the launch itself is processed
and When I call the same code not from the docker, everything works out
What could be the reason?
Remember, while you may have exposed the docker socket inside your container, the docker daemon is running on your host . It's not inside any container. So when you write:
... -v /new/test.py:/new/test.py ...
Docker is looking for /new/test.py
relative to the root of your host filesystem, not inside the container filesystem.
In general, bind mounts aren't going to work in a useful fashion. Named volumes will work fine, of course.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.