How to Start a Docker Container

Posted on

Introduction

As also a part of a docker container articles, there is a specific focus on the content on this article. The content itself is has a specific relation or focus on Docker. It is focusing on how to start a docker container. Actually, the command for starting the docker container is very easy. But depends on the container, it can running and up without having to stop and exit. On the other hand, there are also a container which is running and after it finish, it will stop and exit.

Starting Docker Container

In order to start a docker container, the following is the example of the execution. First of all is starting docker container. The result is the docker container is up and running. That possible scenario exist as follows for an example :

C:\Users\Administrator>docker container list --all
CONTAINER ID   IMAGE      COMMAND                  CREATED        STATUS                      PORTS                    NAMES
3ca3c24f657d   0f55       "bash"                   11 hours ago   Exited (127) 11 hours ago                            blissful_ellis
2cfce8343dcf   0f55       "/bin/bash"              4 days ago     Exited (0) 11 hours ago                              vigilant_grothendieck
8a52dcce139c   registry   "/entrypoint.sh /etc…"   4 days ago     Up 16 hours                 0.0.0.0:5000->5000/tcp   hub.local
8bca4865ac83   centos     "/bin/bash"              5 days ago     Up 12 hours                                          centos_app

C:\Users\Administrator>docker start 3ca3c
3ca3c

C:\Users\Administrator>docker container list --all
CONTAINER ID   IMAGE      COMMAND                  CREATED        STATUS                    PORTS                    NAMES
3ca3c24f657d   0f55       "bash"                   11 hours ago   Up 6 seconds              80/tcp                   blissful_ellis
2cfce8343dcf   0f55       "/bin/bash"              4 days ago     Exited (0) 11 hours ago                            vigilant_grothendieck
8a52dcce139c   registry   "/entrypoint.sh /etc…"   4 days ago     Up 16 hours               0.0.0.0:5000->5000/tcp   hub.local
8bca4865ac83   centos     "/bin/bash"              5 days ago     Up 12 hours                                        centos_app

C:\Users\Administrator>docker

There is a change on the container with the container ID of ‘3ca3c24f657d’ or container name of ‘blissful_ellis’. The status of the that container before is stop. But after executing the command ‘docker start 3ca3c’, it is currently running. On the other hand, there is also a possible scenario where it does not up and running after starting the docker container. It is because of the container has finish running the process or the service available in it. That situation is also exist below as an example :

C:\Users\Administrator>docker start 2cfce
2cfce

C:\Users\Administrator>docker container list --all
CONTAINER ID   IMAGE      COMMAND                  CREATED        STATUS                     PORTS                    NAMES
3ca3c24f657d   0f55       "bash"                   11 hours ago   Up About a minute          80/tcp                   blissful_ellis
2cfce8343dcf   0f55       "/bin/bash"              4 days ago     Exited (0) 9 seconds ago                            vigilant_grothendieck
8a52dcce139c   registry   "/entrypoint.sh /etc…"   4 days ago     Up 16 hours                0.0.0.0:5000->5000/tcp   hub.local
8bca4865ac83   centos     "/bin/bash"              5 days ago     Up 12 hours                                         centos_app

C:\Users\Administrator>

One thought on “How to Start a Docker Container

Leave a Reply