docker运行无法安装文件到容器

我已经检查了本地文件,它们是存在的,请帮忙,我想将本地configuration挂载到容器

sudo docker run -v /usr1/V3R002C10_BP/.m2/settings.xml:/usr/share/apache-maven-3.3.9/conf/settings.xml:rw -v /usr1/V3R002C10_BP/.sbt/repositories:/root/.sbt/repositories:rw -v /usr1/V3R002C10_BP:/usr1/V3R002C10_BP:rw --workdir=/usr1/V3R002C10_BP/task1935/ac_bp_all --net host --name ubuntu_bash5 -i -t hub.witcloud.huawei.com/r00230944/suse11sp3:1.0.2 /bin/bash docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/usr1/V3R002C10_BP/.sbt/repositories\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/34872c92bc91fe920b846d5abff3d43ec0042fe8a1df8a1d20d03b6f24c7ff51\\\" at \\\"/var/lib/docker/aufs/mnt/34872c92bc91fe920b846d5abff3d43ec0042fe8a1df8a1d20d03b6f24c7ff51/root/.sbt/repositories\\\" caused \\\"not a directory\\\"\"" : 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. 

以下是要加载的文件的检查:

 root@LFG1000818717:/opt# ll /usr1/V3R002C10_BP/.m2/settings.xml total 12 drwxrwxrwx 2 root root 4096 Jul 20 17:37 ./ drwxrwxrwx 3 root root 4096 Jul 20 16:33 ../ -rwxrwxrwx 1 root root 2226 Jul 20 17:37 settings.xml.sdn* root@LFG1000818717:/opt# ll /usr1/V3R002C10_BP/.sbt/repositories total 12 drwxrwxrwx 2 root root 4096 Jul 20 17:37 ./ drwxrwxrwx 3 root root 4096 Jul 20 16:33 ../ -rwxrwxrwx 1 root root 456 Jul 20 17:37 repositories* root@LFG1000818717:/opt# ll /usr1/V3R002C10_BP total 28 drwxr-xr-x 7 root root 4096 Jul 20 18:07 ./ drwxr-xr-x 6 root root 4096 Jul 21 04:56 ../ drwxr-xr-x 23 root root 4096 Jul 20 18:28 ac_bp_all/ drwxr-xr-x 2 root root 4096 Jul 20 17:37 gradle/ drwxrwxrwx 3 root root 4096 Jul 20 16:33 .m2/ drwxrwxrwx 3 root root 4096 Jul 20 16:33 .sbt/ drwxr-xr-x 2 root root 4096 Jul 20 18:23 task1935/ 

只需使用docker cp 命令 。 它从主机复制一个文件到一个容器。 这可能比在这种情况下使用docker run更好。

将文件复制到docker cp SRC_PATH CONTAINER:DEST_PATH

将文件从容器复制到主机docker cp CONTAINER:SRC_PATH DEST_PATH

希望这可以帮助!