Day-1: Q1.Explain what is docker container with images?

Docker image:

Docker image is a collection of file system (Root FS, User FS and App FS).

Use “docker images” command to see the docker images

root@ip-172-31-28-155:/home/ubuntu# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
bash         latest    8856ae160078   2 days ago    12.9MB
alpine       latest    14119a10abf4   2 days ago    5.6MB
python       latest    1e76b28bfd4e   12 days ago   911MB
nginx        latest    dd34e67e3371   12 days ago   133MB
httpd        latest    c8ca530172a8   12 days ago   138MB
ubuntu       latest    1318b700e415   4 weeks ago   72.8MB
fedora       latest    dce66322d647   5 weeks ago   178MB

Docker Container:

Docker container is the runnable instance of docker image.

Docker container contains 1 ROOT FS, 1 PID, 1 NET and 1 USER and attach ROOT FS, PID and NET to user.

One copy of docker image get attached to each container

Use “docker ps” command to see all docker containers with status “UP”

Use “docker ps – a” command to see all docker containers with all status including “UP/ Exited /Created”


root@ip-172-31-28-155:/home/ubuntu# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED             STATUS                   PORTS     NAMES
377816ab4f23   httpd     "httpd-foreground"       3 minutes ago       Up About a minute        80/tcp    mani
ca9d52449136   nginx     "/docker-entrypoint.…"   10 minutes ago      Up 10 minutes            80/tcp    tender_lewin
bdc16464a31f   nginx     "/docker-entrypoint.…"   20 minutes ago      Up 20 minutes (Paused)   80/tcp    akilan
b1f8b2f42f2b   httpd     "httpd-foreground"       22 minutes ago      Up 20 minutes            80/tcp    soumya2
16a185dabdf9   httpd     "httpd-foreground"       27 minutes ago      Up 19 minutes            80/tcp    sunil_httpd
6a0a25cd90ab   httpd     "httpd-foreground"       30 minutes ago      Up About a minute        80/tcp    Aji_httpd
2a042b66db52   httpd     "httpd-foreground"       31 minutes ago      Up 22 minutes            80/tcp    akhil
c5a741893181   httpd     "httpd-foreground"       32 minutes ago      Up 20 minutes            80/tcp    anoop2
fc660bad9f21   httpd     "httpd-foreground"       32 minutes ago      Up 19 minutes            80/tcp    anoop1
2344c2aeb233   httpd     "httpd-foreground"       33 minutes ago      Up 20 minutes            80/tcp    soumya
2440b6313daf   httpd     "httpd-foreground"       34 minutes ago      Up 34 minutes            80/tcp    sabeesh
275c494c90da   httpd     "httpd-foreground"       34 minutes ago      Up 8 minutes             80/tcp    bitto
2d0eb09c5f08   httpd     "httpd-foreground"       34 minutes ago      Up 7 minutes             80/tcp    abhi
835d1360683d   httpd     "httpd-foreground"       35 minutes ago      Up 29 minutes            80/tcp    sree
be4ecabd1a51   httpd     "httpd-foreground"       36 minutes ago      Up 29 minutes            80/tcp    aswathi
67cc6c2d35b3   httpd     "httpd-foreground"       38 minutes ago      Up 33 minutes (Paused)   80/tcp    test1
ad62efdc813f   httpd     "httpd-foreground"       39 minutes ago      Up 34 minutes            80/tcp    kannan
ccb658e63dbb   httpd     "httpd-foreground"       41 minutes ago      Up 37 minutes            80/tcp    jenish1
30daf8cff021   ubuntu    "bash"                   About an hour ago   Up About an hour                   pensive_driscoll
797e8c71bba0   httpd     "httpd-foreground"       About an hour ago   Up About an hour         80/tcp    raj1
root@ip-172-31-28-155:/home/ubuntu#
root@ip-172-31-28-155:/home/ubuntu#
root@ip-172-31-28-155:/home/ubuntu# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED             STATUS                        PORTS     NAMES
377816ab4f23   httpd          "httpd-foreground"       3 minutes ago       Up 2 minutes                  80/tcp    mani
ca9d52449136   nginx          "/docker-entrypoint.…"   10 minutes ago      Up 10 minutes                 80/tcp    tender_lewin
14cd4df861c1   httpd          "httpd-foreground"       18 minutes ago      Exited (0) 16 minutes ago               jaison
0ace859e4691   httpd          "httpd-foreground"       18 minutes ago      Created                                 wtest2
890b20cc793d   httpd          "httpd-foreground"       19 minutes ago      Exited (137) 19 minutes ago             SujithSunny
bdc16464a31f   nginx          "/docker-entrypoint.…"   20 minutes ago      Up 20 minutes (Paused)        80/tcp    akilan
4cb85adb7671   nginx          "/docker-entrypoint.…"   21 minutes ago      Exited (0) 20 minutes ago               akilan2
5d73fddb1f99   httpd          "httpd-foreground"       21 minutes ago      Exited (137) 14 minutes ago             jenish2
b8612f701078   httpd          "httpd-foreground"       22 minutes ago      Created                                 affectionate_almeida
b1f8b2f42f2b   httpd          "httpd-foreground"       22 minutes ago      Up 21 minutes                 80/tcp    soumya2
16a185dabdf9   httpd          "httpd-foreground"       27 minutes ago      Up 19 minutes                 80/tcp    sunil_httpd
ace65c455fea   httpd          "httpd-foreground"       27 minutes ago      Exited (137) 23 minutes ago             alshameer1
1014971b2468   httpd          "httpd-foreground"       29 minutes ago      Exited (0) 19 minutes ago               alshameer
f2ae9017d782   python         "python3"                29 minutes ago      Exited (0) 28 minutes ago               sunil
6a0a25cd90ab   httpd          "httpd-foreground"       30 minutes ago      Up About a minute             80/tcp    Aji_httpd
13fbd5fad3f3   httpd          "httpd-foreground"       30 minutes ago      Created                                 nifty_hellman
2a042b66db52   httpd          "httpd-foreground"       31 minutes ago      Up 22 minutes                 80/tcp    akhil
c5a741893181   httpd          "httpd-foreground"       32 minutes ago      Up 20 minutes                 80/tcp    anoop2
05d0bb37cd21   httpd          "httpd-foreground"       32 minutes ago      Exited (0) 23 minutes ago               srm
fc660bad9f21   httpd          "httpd-foreground"       32 minutes ago      Up 20 minutes                 80/tcp    anoop1
e06e80789c87   httpd          "--name aji_httpd"       33 minutes ago      Created                       80/tcp    gifted_shannon
2344c2aeb233   httpd          "httpd-foreground"       33 minutes ago      Up 20 minutes                 80/tcp    soumya
bdf58568dbe6   httpd          "httpd-foreground"       34 minutes ago      Exited (137) 19 minutes ago             vin6
548886386f8b   httpd          "httpd-foreground"       34 minutes ago      Exited (137) 2 minutes ago              rajuc
a0244d0286c2   httpd          "sujith"                 34 minutes ago      Created                       80/tcp    agitated_joliot
2440b6313daf   httpd          "httpd-foreground"       34 minutes ago      Up 34 minutes                 80/tcp    sabeesh
275c494c90da   httpd          "httpd-foreground"       34 minutes ago      Up 8 minutes                  80/tcp    bitto
3b7a3ce91c5f   httpd          "httpd-foreground"       34 minutes ago      Created                                 upbeat_kirch
c773bc041cf5   httpd          "httpd-foreground"       34 minutes ago      Exited (0) 33 minutes ago               xenodochial_jones
2d0eb09c5f08   httpd          "httpd-foreground"       35 minutes ago      Up 7 minutes                  80/tcp    abhi
433f2a1e6e72   httpd          "httpd-foreground"       35 minutes ago      Created                                 nostalgic_bohr
28525b0ff5df   httpd          "httpd-foreground"       35 minutes ago      Exited (0) 10 minutes ago               abhin
e856e5b78cea   httpd          "httpd-foreground"       35 minutes ago      Exited (137) 6 minutes ago              sooraj
835d1360683d   httpd          "httpd-foreground"       35 minutes ago      Up 29 minutes                 80/tcp    sree
be4ecabd1a51   httpd          "httpd-foreground"       36 minutes ago      Up 29 minutes                 80/tcp    aswathi
fb86828043cd   ubuntu         "bash"                   36 minutes ago      Exited (0) 36 minutes ago               vin3
e579aaf35c25   nginx:latest   "/docker-entrypoint.…"   37 minutes ago      Exited (137) 37 minutes ago             gracious_montalcini
3048c78a152c   alpine         "/bin/sh"                38 minutes ago      Exited (0) 38 minutes ago               vin2
67cc6c2d35b3   httpd          "httpd-foreground"       38 minutes ago      Up 33 minutes (Paused)        80/tcp    test1
8ec8b56eb496   nginx:latest   "/docker-entrypoint.…"   39 minutes ago      Exited (0) 38 minutes ago               naughty_leavitt
ad62efdc813f   httpd          "httpd-foreground"       39 minutes ago      Up 35 minutes                 80/tcp    kannan
6f44c9a89d38   nginx:latest   "/docker-entrypoint.…"   39 minutes ago      Exited (0) 39 minutes ago               suspicious_shannon
69659e68945b   fedora         "/bin/bash"              39 minutes ago      Exited (0) 38 minutes ago               vin1
ccb658e63dbb   httpd          "httpd-foreground"       41 minutes ago      Up 37 minutes                 80/tcp    jenish1
30daf8cff021   ubuntu         "bash"                   About an hour ago   Up About an hour                        pensive_driscoll
e661437407b7   httpd          "httpd-foreground"       About an hour ago   Created                                 raj2
797e8c71bba0   httpd          "httpd-foreground"       About an hour ago   Up About an hour              80/tcp    raj1