与主机共享Docker Process Executable

时间:2018-06-10 03:59:30

标签: linux docker docker-compose

这个问题与docker-compose无关 Mount directory in Container and share with HostHow to mount a directory inside a docker container on Linux host 我想要的是在主机(Mac)中共享docker可执行文件,假设我在docker容器/usr/bin/aria2c中有一个路径,想要将它共享给主机,所以它可以被终端或任何应用程序全局使用。

我的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

输出:

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

我知道文件在主机中不可用,但有没有方法可以启动容器,然后将容器可执行文件符号链接到主机。

0 个答案:

没有答案