我一直在浏览这里链接的用户指南:
Docker User Guide: Containers。
我在docker终端中运行了以下命令:
$ docker run -d ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
$ docker ps -a
true;: 1: true;: Syntax error: end of file unexpected
$ docker run ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
true;: 1: true;: Syntax error: end of file unexpected
最佳答案
尝试使用单引号:
docker run -d ubuntu:14.04 /bin/sh -c 'while true; do echo hello world; sleep 1; done'
注意:作为mentioned here:When I try to use VirtualBox's console there is all fine.
But it always fail in windows's console (using Docker Quickstart Terminal).
I think the problem is about the end-of-line code (
\n
,\r
or\r\n
).
docker-machine ssh $(docker-machine ip <machine_name>)
),然后再试一次。default
”的docker-machine,您甚至不必键入任何内容(在这里,我使用dm
作为docker-machine
的别名):关于shell - Docker教程: Daemonized Container Closes - Syntax Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35027608/