- Learn OpenShift
- Denis Zuev Artemii Kropachev Aleksey Usov
- 218字
- 2021-08-13 16:03:46
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:

- Linux設備驅動開發詳解(第2版)
- Learning Windows Server Containers
- 精通Linux內核開發
- 嵌入式應用程序設計綜合教程(微課版)
- 嵌入式操作系統(Linux篇)(微課版)
- Instant Optimizing Embedded Systems using Busybox
- Application Development in iOS 7
- 計算機系統:基于x86+Linux平臺
- Vim 8文本處理實戰
- 跟老男孩學Linux運維:Shell編程實戰
- Windows 7使用詳解(修訂版)
- 鴻蒙HarmonyOS手機應用開發實戰
- Windows網絡編程(第2版)
- 15分鐘!畫出我的漫畫角色:賣萌篇
- 程序員必讀經典(算法基礎+計算機系統)