docker run image diff无法正常执行

时间:2017-09-06 00:06:52

标签: docker

我遇到了docker run语法的问题...我已经尝试了这两个命令,它们似乎都在最后一行生成错误消息。

docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} /bin/bash -c "diff /usr/local/bin/protoc /go/bin/protoc2"

docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} diff /usr/local/bin/protoc /go/bin/protoc2

diff: /go/bin/protoc2/protoc: No such file or directory

我是否遗漏了语法方面的内容?我不确定为什么它没有正确运行我的命令。

1 个答案:

答案 0 :(得分:0)

$ sudo cp /bin/ls /bin/ls2
$ docker run --rm -v /bin/ls2:/bin/ls2 ubuntu:16.04 diff /bin/ls /bin/ls2
Binary files /bin/ls and /bin/ls2 differ. 

所以我很确定你的本地挂载不存在并创建一个目录。

将运行语句更改为

docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} /bin/bash -c "ls -alh /go/bin/protoc2 && diff /usr/local/bin/protoc /go/bin/protoc2"

你会知道出了什么问题