Docker exec pipe没有这样的文件或目录

时间:2019-05-08 15:49:33

标签: docker

出于某种原因,>找不到文件test.txt,但是ls却找到了。

$ docker exec mycont ls /headless/Desktop
test.txt
$ docker exec mycont ls /headless/Desktop > /headless/Desktop/test.txt
-bash: /headless/Desktop/test.txt: No such file or directory

1 个答案:

答案 0 :(得分:1)

docker exec mycont bash -c "ls /headless/Desktop > /headless/Desktop/test.txt"

您希望docker在容器中而不是在主机上查找文件