Home >Operation and Maintenance >Docker >How to shut down processes in docker containers

How to shut down processes in docker containers

尚
Original
2020-04-01 10:39:398621browse

How to shut down processes in docker containers

How to close the process in the docker container:

1. Use the docker exec container name ps -ef command to view the process information

Example:

Create a container named "redis" and view the process information in the container inside the container and on the host:

docker@default:~$ docker run -d --name redis redis
f6bc57cc1b464b05b07b567211cb693ee2a682546ed86c611b5d866f6acc531c
docker@default:~$ docker exec redis ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
redis        1     0  0 01:49 ?        00:00:00 redis-server *:6379
root        11     0  0 01:49 ?        00:00:00 ps -ef
docker@default:~$ docker top redis
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
999                 9302                1264                0                   01:49               ?                   00:00:00            redis-server *:6379

2. Then enter the container and execute the following command: The process can be stopped:

kill pid

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of How to shut down processes in docker containers. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn