This question is related to docker-compose not related to
Mount directory in Container and share with Host
, How to mount a directory inside a docker container on Linux host
What i want is sharing docker executables in hosts machine (Mac), Suppose I have a path in docker container /usr/bin/aria2c
, Want to share it to host, so it can be globally used by terminal or any app.
My Docker-compose.yml
version: "2.0"
services:
slate:
container_name: Aria
image: abcminiuser/docker-aria2-with-webui
restart: always
ports:
- 6800:6800
- 6880:80
environment:
- UID=100
- GID=1001
volumes:
- /Users/rahul/Downloads:/data #Where Real Downloads Happen
- /Users/rahul:/usr/bin/aria2c #point exectable to home dir
Output :
ERROR: for slate Cannot start service slate: 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 \\\\\\"/Users/rahul\\\\\\" to rootfs \\\\\\"/var/lib/docker/overlay2/7e712f0c3f26b123000d74b9d7e4f6109e724eb8d30329c22925ba728793db12/merged\\\\\\" at \\\\\\"/var/lib/docker/overlay2/7e712f0c3f26b123000d74b9d7e4f6109e724eb8d30329c22925ba728793db12/merged/usr/bin/aria2c\\\\\\" 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 know file is not available in the hosts, But Is there a method to let boot the container and then symlink container executable to host.