Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Terminate the Docker container


May 22, 2021 Docker From entry to practice



You docker stop to terminate a running container.

In addition, when the app specified in the Docker container ends, the container is automatically terminated. For example, if only one terminal container was started in the previous section, exit created terminates immediately when the user exits the terminal through the exit command or Ctrl+d

Containers that terminate the state can docker ps -a command. For example

sudo docker ps -a
CONTAINER ID        IMAGE                    COMMAND                CREATED             STATUS                          PORTS               NAMES
ba267838cc1b        ubuntu:14.04             "/bin/bash"            30 minutes ago      Exited (0) About a minute ago                       trusting_newton
98e5efa7d997        training/webapp:latest   "python app.py"        About an hour ago   Exited (0) 34 minutes ago                           backstabbing_pike

Containers that are in a terminated state can docker start command.

In addition, docker restart command terminates a running container and then restarts it.