2
我在關注Docker的文檔以瞭解Docker如何工作。Docker容器無法作爲守護進程運行
但我滿足該Doc問題,
的說,當運行此命令:
$ docker run -d ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
一個守護進程,因爲-d
標誌的開始。
但檢查與docker ps
命令運行的容器中時,它是空的,只有標題:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
使用docker ps -a
命令來觀看我看到這一切的容器:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7f1bebd5a49 ubuntu:14.04 "/bin/sh -c while tru" 6 minutes ago Exited (2) 4 minutes ago cranky_mcclintock
它以error code 2
退出。看日誌:
docker logs e7f1bebd5a49
true;: 1: true;: Syntax error: end of file unexpected
爲什麼會發生這種情況?我在Windows 10中運行Docker(使用Docker快速入門終端)。
這是我docker info
部分:
Containers: 3
Images: 52
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 58
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.13-boot2docker
Operating System: Boot2Docker 1.9.1 (TCL 6.4.1);
CPUs: 1
Total Memory: 996.2 MiB
Name: default
Debug mode (server): true
File Descriptors: 12
Goroutines: 20
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
這裏是docker events
後docker run
$ docker run -d ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
e7f1bebd5a490e35ce8451c5f12a4a4f4e089bd70fc6ad1726e927a0610f3e49
2016-01-14T13:20:55.350098419+08:00 e7f1bebd5a490e35ce8451c5f12a4a4f4e089bd70fc6ad1726e927a0610f3e49: (from ubuntu:14.04) create
2016-01-14T13:20:55.363562836+08:00 e7f1bebd5a490e35ce8451c5f12a4a4f4e089bd70fc6ad1726e927a0610f3e49: (from ubuntu:14.04) start
2016-01-14T13:20:55.436727252+08:00 e7f1bebd5a490e35ce8451c5f12a4a4f4e089bd70fc6ad1726e927a0610f3e49: (from ubuntu:14.04) die
而'docker events'顯示? – user2915097
@ user2915097感謝評論,更多細節已在上面添加。 – Nutto
它適用於docker v1.8.3和docker-machine 0.4.1。 – Opal