Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Docker Tutorials: Lifecycle of Docker Containers

We need to carefully understand the life cycle of Docker containes. There are following images which depicts the the right phases of docker containers.

Phase of Docker Containers

  • Create -> Destroy
  • Create -> Start -> Stopped -> Destroy
  • Create -> Start -> Pause -> Unpause
  • Create -> Start -> Restart

Image flow of Simple Docker Container Lifecycle

Image flow of Detailed Docker Container Lifecycle

Image Source and Credits: http://docker-saigon.github.io/post/Docker-Internals/

Create container
$ docker create –name ubuntu-cont ubuntu

Run docker container
$ docker run -itd ubuntu
$ docker run -itd –name ubuntu-cont ubuntu

Pause container
$ docker pause <container-id/name>

Unpause container
$ docker unpause <container-id/name>

Start container
$ docker start <container-id/name>

Stop container
$ docker stop <container-id/name>

Restart container
$ docker restart <container-id/name>

Kill container
$ docker kill <container-id/name>

Destroy container
$ docker rm <container-id/name>

Docker Tutorials Fundamental To Advanced-2021 Crash Course:- https://bit.ly/3hOIbTB


List of Commands

   1  docker images
    2  docker ps
    3  docker ps -a
    4  docker pull httpd
    5  docker images
    6  clear
    7  ls
    8  docker create httpd
    9  docker ps
   10  docker ps -a
   11  docker ps -a
   12  docker start f7b6f6169996
   13  docker ps
   14  docker create httpd
   15  docker create httpd
   16  clear
   17  docker ps -a
   18  docker stop f7b6f6169996
   19  docker ps -a
   20  docker start f7b6f6169996
   21  docker ps -a
   22  clear
   23  docker ps -a
   24  docker restart f7b6f6169996
   25  docker ps -a
   26  docker pause f7b6f6169996
   27  docker ps -a
   28  docker unpause f7b6f6169996
   29  docker ps -a
   30  clear
   31  docker ps
   32  docker kill f7b6f6169996
   33  docker ps -a
   34  docker rm f7b6f6169996 846ac70399e5 125cf21c5805
   35  clear
   36  docker ps -a
   37  docker create httpd
   38  docker ps -a
   39  docker start d2284fa3b876
   40  docker stop d2284fa3b876
   41  docker start d2284fa3b876
   42  docker restart d2284fa3b876
   43  docker pause d2284fa3b876
   44  docker unpause d2284fa3b876
   45  docker kill d2284fa3b876
   46  docker rm d2284fa3b876
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x