docker_practice/container/daemon.md

47 lines
1.4 KiB
Go
Raw Permalink Normal View History

#
2014-09-15 21:25:36 +08:00
Docker 宿 `-d`
2014-09-15 21:25:36 +08:00
使 `-d`
```bash
$ docker run ubuntu:18.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
hello world
hello world
hello world
hello world
2014-09-15 21:25:36 +08:00
```
(STDOUT) 宿
使 `-d`
```bash
$ docker run -d ubuntu:18.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
77b2dc01fe0f3f1265df143181e7b9af5e05279a884f4776ee75350ea9d8017a
```
(STDOUT) 宿( `docker logs` )
**** `docker run` `-d`
2014-09-15 21:25:36 +08:00
使 `-d` id `docker container ls`
```
$ docker container ls
2014-09-15 21:25:36 +08:00
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
77b2dc01fe0f ubuntu:18.04 /bin/sh -c 'while tr 2 minutes ago Up 1 minute agitated_wright
2014-09-15 21:25:36 +08:00
```
`docker container logs`
```bash
$ docker container logs [container ID or NAMES]
2014-09-15 21:25:36 +08:00
hello world
hello world
hello world
. . .
```