我理解--i和--t标志的不同之处,但是,当我运行以下两个命令时,它们在返回结果时的行为不同
$ docker run -it busybox sh
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
bdbbaa22dec6: Pull complete
Digest: sha256:6915be4043561d64e0ab0f8f098dc2ac48e077fe23f488ac24b665166898115a
Status: Downloaded newer image for busybox:latest
/ # ls
bin dev etc home proc root sys tmp usr var
/ # 上面的方法是可行的。现在,我删除了--t标志,我期望"ls“应该返回结果,尽管没有附加tty。
$ docker run -i busybox sh
ls
: not found - ls不可用的原因是什么,听起来很奇怪?
编辑1:更多的观察-
$ docker run -i ubuntu
ls
/bin/bash: line 1: $'ls\r': command not found
pwd
/bin/bash: line 2: $'pwd\r': command not found
exit
/bin/bash: line 3: $'exit\r': command not found 再来一个,
$ docker run -i ubuntu sh
ls
: not found
exit
: not found 发布于 2020-02-26 10:49:17
看起来像是行尾的问题。我正在从windows运行命令。不管怎样,我换成了docker-machine,现在一切都正常了。
请查看此处- https://github.com/docker/for-win/issues/1891
在windows中运行时,不确定如何修复此问题
$ docker-machine ssh
( '>')
/) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY.
(/-_--_-\) www.tinycorelinux.net
docker@default:~$ sudo su root
root@default:/home/docker# docker run -i busybox sh
ls
bin
dev
etc
home
proc
root
sys
tmp
usr
var
exit https://stackoverflow.com/questions/60406005
复制相似问题