- 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網絡操作系統與實訓(第三版)
- WordPress Mobile Web Development:Beginner's Guide
- Kali Linux滲透測試全流程詳解
- 開源安全運維平臺OSSIM疑難解析:入門篇
- Windows Server 2012網絡操作系統企業應用案例詳解
- Dreamweaver CS5.5 Mobile and Web Development with HTML5,CSS3,and jQuery
- 蘋果OS X Mavericks 10.9應用大全
- CentOS 6 Linux Server Cookbook
- 大規模分布式系統架構與設計實戰
- Docker容器技術與應用
- OpenHarmony開發與實踐:基于紅莓RK2206開發板
- Microsoft Hyper-V Cluster Design
- Android NDK Beginner's Guide
- 計算機應用基礎(Windows 7+Office 2010)
- 鴻蒙HarmonyOS應用開發從入門到精通