官术网_书友最值得收藏!

Docker ps and logs

Run the docker ps command to show that there are no running containers:

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

Run docker ps -a to show both running and stopped containers:

$ docker ps -a

The output of the preceding command will be as shown in the following screenshot:

There are a few things to note here. The STATUS field says that container 5e3820a43ffc exited about one minute ago. In order to get container log information, we can use the docker logs command:

$ docker logs 5e3820a43ffc

The output of the preceding command will be as shown in the following screenshot:

The last message says caught SIGTERM, shutting down. It happened after we pressed Ctrl C. In order to run a container in background mode, we can use the -d option with the docker run command:

$ docker run -d httpd
5d549d4684c8e412baa5e30b20697b72593d87130d383c2273f83b5ceebc4af3

It generates a random ID, the first 12 characters of which are used for the container ID. Along with the generated ID, a random container name is also generated.

Run docker ps to verify the container ID, name, and status:

$ docker ps

The output of the preceding command will be as shown in the following screenshot:

主站蜘蛛池模板: 吴桥县| 胶州市| 凤城市| 台州市| 丰宁| 宾阳县| 巴彦淖尔市| 静海县| 通城县| 焉耆| 秦安县| 闽侯县| 阳江市| 南江县| 博客| 五原县| 翼城县| 大兴区| 乌鲁木齐县| 临汾市| 宜兰县| 福泉市| 红安县| 永顺县| 莱州市| 墨脱县| 耒阳市| 明星| 宁河县| 田阳县| 扬中市| 财经| 昌宁县| 临湘市| 页游| 六枝特区| 怀远县| 时尚| 虎林市| 镇雄县| 安仁县|