Languages
[Edit]
EN

Docker - kill container

1 points
Created by:
Root-ssh
7587

In this short article we would like to show how to kill docker container.

Quick solution (run following command):

docker kill put_container_id_here

Detailed steps example

It is important to know container id to stop proper container. This section shows how to find that id and use it to kill container.

Simple steps:

  1. find container id listing all containers with following command:
    docker ps
    Output:
    CONTAINER ID     IMAGE                                                           COMMAND                   CREATED             STATUS                     PORTS                                      NAMES
    4f2135f4f315     408729922323.dkr.ecr.eu-west-1.amazonaws.com/backend:master     "/docker-entrypoint.…"    22 minutes ago      Up 22 minutes (healthy)    80/tcp, 443/tcp, 0.0.0.0:8080->8080/tcp    deploy_backend
    f43154f5213f     987224932320.dkr.ecr.eu-west-1.amazonaws.com/frontend:master    "/docker-entrypoint.…"    21 minutes ago      Up 21 minutes (healthy)    81/tcp, 443/tcp, 0.0.0.0:8081->8081/tcp    deploy_frontend

    We want to stop container with id equal to 4f2135f4f315 .

  2. kill container with following command:
    docker kill 4f2135f4f315
Hey 👋
Would you like to know what we do?
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.