【发布时间】:2018-11-17 11:12:37
【问题描述】:
我正在尝试在正在运行的 docker 容器中运行特定命令。
Docker exec -t t1 ls /tmp/sth/*
作为回报,我收到了
ls: cannot access '/tmp/sth/*': No such file or directory
事实上,当我在容器内执行命令时,一切正常。容器使用 Debian,本地机器使用 Windows。我试图找到它,但找不到。
【问题讨论】:
-
这是正常/预期的行为。在 UNIX 世界中,在 shell 启动程序之前,glob 由你的 shell 扩展。因此,当调用
ls时,它期望已经传递/tmp/sth中的文件列表,而不是通配符。在这种情况下,glob仅在容器内部有效,因此容器外部的shell无法看到扩展它的结果。
标签: linux windows docker containers system