Docker: Committing Image, Linking Containers, Creating Volume, Backup and Deleting a container


Committing the image with some message, as we do in git.

-bash-4.2$ sudo docker commit -m "Added httpd on CentOS" -a "Shantanu" f3bc073ecc85 shaan2212/centos:versionnew
sha256:adbc83d26a394399663e4730e0a9c98f7906a12ab2bcab703d926abb6e82edd6
-bash-4.2$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
shaan2212/centos    versionnew          adbc83d26a39        15 seconds ago      269MB
ubuntu              latest              775349758637        4 weeks ago         64.2MB
centos              latest              0f3e07c0138f        8 weeks ago         220MB
hello-world         latest              fce289e99eb9        11 months ago       1.84kB
training/webapp     latest              6fae60ef3446        4 years ago         349MB
-bash-4.2$

Pushing the new image named as "centos:versionnew" to dockerhub

-bash-4.2$ sudo docker push shaan2212/centos:versionnew
The push refers to repository [docker.io/shaan2212/centos]
8c4f4ced0acf: Pushed
9e607bb861a7: Mounted from library/centos
versionnew: digest: sha256:c51555b889b09b3dc5b3f3ddf0a70a3ee676ffd92a3350939bd7f44d6119703b size: 741
-bash-4.2$

https://hub.docker.com/repository/docker/shaan2212/centos   === We can find it here now


Remove a docker image from the local system.

-bash-4.2$ sudo docker rmi shaan2212/centos:versionnew
Untagged: shaan2212/centos:versionnew
Untagged: shaan2212/centos@sha256:c51555b889b09b3dc5b3f3ddf0a70a3ee676ffd92a3350939bd7f44d6119703b
Deleted: sha256:adbc83d26a394399663e4730e0a9c98f7906a12ab2bcab703d926abb6e82edd6
Deleted: sha256:c6320d74c682c7ae027d1b8a10db9723640d5a83e0162a42341e5ac31b33060e
-bash-4.2$


-bash-4.2$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              775349758637        4 weeks ago         64.2MB
centos              latest              0f3e07c0138f        8 weeks ago         220MB
hello-world         latest              fce289e99eb9        11 months ago       1.84kB
training/webapp     latest              6fae60ef3446        4 years ago         349MB
-bash-4.2$

Linking Containers using --link command:

Links allow containers to discover each other and securely transfer information about one container to another container. When you set up a link, you create a conduit between a source container and a recipient container. The recipient can then access select data about the source.


Running a container on postgres image with name "dblink"

-bash-4.2$ sudo docker run -d --name dblink training/postgres

Unable to find image 'training/postgres:latest' locally
latest: Pulling from training/postgres
Image docker.io/training/postgres:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
a3ed95caeb02: Pull complete
6e71c809542e: Pull complete
2978d9af87ba: Pull complete
e1bca35b062f: Pull complete
500b6decf741: Pull complete
74b14ef2151f: Pull complete
7afd5ed3826e: Pull complete
3c69bb244f5e: Pull complete
d86f9ec5aedf: Pull complete
010fabf20157: Pull complete
Digest: sha256:a945dc6dcfbc8d009c3d972931608344b76c2870ce796da00a827bd50791907e
Status: Downloaded newer image for training/postgres:latest
cd1e31374441740e45500f0dfc1c89c6c05da692f3f6506ec7eb9216997d0170

-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
cd1e31374441        training/postgres   "su postgres -c '/us…"   26 seconds ago      Up 24 seconds       5432/tcp            dblink

-bash-4.2$ sudo docker logs dblink
2019-11-29 06:06:45 UTC LOG:  database system was interrupted; last known up at 2014-06-02 23:51:25 UTC
2019-11-29 06:06:45 UTC LOG:  database system was not properly shut down; automatic recovery in progress
2019-11-29 06:06:45 UTC LOG:  redo starts at 0/1782F38
2019-11-29 06:06:45 UTC LOG:  record with zero length at 0/17835C8
2019-11-29 06:06:45 UTC LOG:  redo done at 0/1783598
2019-11-29 06:06:45 UTC LOG:  last completed transaction was at log time 2014-06-02 23:51:25.978993+00
2019-11-29 06:06:45 UTC LOG:  database system is ready to accept connections
2019-11-29 06:06:45 UTC LOG:  autovacuum launcher started


Started another container with name "web" and linked it with the previous container by using --link dblink:dblinknew (--link <name or id>:alias)

-bash-4.2$ sudo docker run -d -P --name web --link dblink:dblinknew training/webapp python app.py
eb3041503270bce10dcb8a9da2fbcecfbd87d302a5f2bb6004b6db313d8f93bb
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
eb3041503270        training/webapp     "python app.py"          9 seconds ago       Up 7 seconds        0.0.0.0:32768->5000/tcp   web
cd1e31374441        training/postgres   "su postgres -c '/us…"   5 minutes ago       Up 5 minutes        5432/tcp                  dblink
-bash-4.2$ curl http://0.0.0.0:32768
Hello world!-bash-4.2$


Link can be checked by inspecting the web container:


-bash-4.2$ sudo docker inspect web | grep -i link
            "Links": [
                "/dblink:/web/dblinknew"
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
                    "Links": null,
-bash-4.2$


Docker creates several environment variables when you link containers. Docker automatically creates environment variables in the target container based on the --link parameters. It also exposes all environment variables originating from Docker from the source container. These include variables from:

the ENV commands in the source container’s Dockerfile
the -e, --env, and --env-file options on the docker run command when the source container is started


--rm can be used when we want to exit/terminate the container after fulfilling the requirement.

--rm : Remove container after run. Ignored in detached mode.

-bash-4.2$ sudo docker run --rm --name web3 --link dblink:dblinknew training/webapp env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=d40aac4fbaad
DBLINKNEW_PORT=tcp://172.17.0.2:5432
DBLINKNEW_PORT_5432_TCP=tcp://172.17.0.2:5432
DBLINKNEW_PORT_5432_TCP_ADDR=172.17.0.2
DBLINKNEW_PORT_5432_TCP_PORT=5432
DBLINKNEW_PORT_5432_TCP_PROTO=tcp
DBLINKNEW_NAME=/web3/dblinknew
DBLINKNEW_ENV_PG_VERSION=9.3
HOME=/root
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
eb3041503270        training/webapp     "python app.py"          7 minutes ago       Up 7 minutes        0.0.0.0:32768->5000/tcp   web
cd1e31374441        training/postgres   "su postgres -c '/us…"   12 minutes ago      Up 12 minutes       5432/tcp                  dblink
-bash-4.2$


In addition to the environment variables, Docker adds a host entry for the source container to the /etc/hosts file. Here’s an entry for the web container. You can see two relevant host entries. The first is an entry for the dblink ontainer that uses the Container ID as a host name. The second entry uses the link alias to reference the IP address of the new container.


-bash-4.2$ sudo docker run -ti --rm --link dblink:web training/webapp /bin/bash
root@32c9ca99e004:/opt/webapp# cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      web cd1e31374441 dblink
172.17.0.4      32c9ca99e004
root@32c9ca99e004:/opt/webapp#


-bash-4.2$ sudo docker stop dblink
dblink

-bash-4.2$ sudo docker stop web
web


-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
-bash-4.2$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              775349758637        4 weeks ago         64.2MB
centos              latest              0f3e07c0138f        8 weeks ago         220MB
hello-world         latest              fce289e99eb9        11 months ago       1.84kB
training/webapp     latest              6fae60ef3446        4 years ago         349MB
training/postgres   latest              6fa973bb3c26        5 years ago         365MB
-bash-4.2$

Creating Volume:

Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker. Volumes have several advantages over bind mounts:

Volumes are easier to back up or migrate than bind mounts.
You can manage volumes using Docker CLI commands or the Docker API.
Volumes work on both Linux and Windows containers.
Volumes can be more safely shared among multiple containers.
Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.
New volumes can have their content pre-populated by a container.
In addition, volumes are often a better choice than persisting data in a container’s writable layer, because a volume does not increase the size of the containers using it, and the volume’s contents exist outside the lifecycle of a given container.

-h : It is used to update the container hostname.
-v : It is used to specify the volume on the container.


The idea is to mount a volume in a container and write some data into it. Later on, we can share the same volume to another container and we must find out the data written to the 1st container inside the volume.

-bash-4.2$ sudo docker run -it --name container-data -h CONTAINER -v /data debian /bin/bash

Unable to find image 'debian:latest' locally
latest: Pulling from library/debian
16ea0e8c8879: Pull complete
Digest: sha256:79f0b1682af1a6a29ff63182c8103027f4de98b22d8fb50040e9c4bb13e3de78
Status: Downloaded newer image for debian:latest
root@CONTAINER:/# ls
bin  boot  data  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@CONTAINER:/# df -Ph
Filesystem               Size  Used Avail Use% Mounted on
overlay                   17G  2.9G   15G  17% /
tmpfs                     64M     0   64M   0% /dev
tmpfs                    487M     0  487M   0% /sys/fs/cgroup
shm                       64M     0   64M   0% /dev/shm
/dev/mapper/centos-root   17G  2.9G   15G  17% /data
tmpfs                    487M     0  487M   0% /proc/asound
tmpfs                    487M     0  487M   0% /proc/acpi
tmpfs                    487M     0  487M   0% /proc/scsi
tmpfs                    487M     0  487M   0% /sys/firmware
root@CONTAINER:/#
root@CONTAINER:/#
root@CONTAINER:/# cd /data
root@CONTAINER:/data# pwd
/data
root@CONTAINER:/data#
root@CONTAINER:/data#
root@CONTAINER:/data# ls -l
total 0
root@CONTAINER:/data#
root@CONTAINER:/data# echo "hello" > myfile
root@CONTAINER:/data#
root@CONTAINER:/data#
root@CONTAINER:/data# ll
bash: ll: command not found
root@CONTAINER:/data#
root@CONTAINER:/data# ls -l
total 4
-rw-r--r--. 1 root root 6 Nov 30 05:28 myfile
root@CONTAINER:/data#
root@CONTAINER:/data#
root@CONTAINER:/data# exit
exit
-bash-4.2$
-bash-4.2$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
debian              latest              67e34c1c9477        7 days ago          114MB
ubuntu              latest              775349758637        4 weeks ago         64.2MB
centos              latest              0f3e07c0138f        8 weeks ago         220MB
hello-world         latest              fce289e99eb9        11 months ago       1.84kB
training/webapp     latest              6fae60ef3446        4 years ago         349MB
training/postgres   latest              6fa973bb3c26        5 years ago         365MB
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
-bash-4.2$

-bash-4.2$ sudo docker inspect container-data | grep -i volume
            "VolumeDriver": "",
            "VolumesFrom": null,
                "Type": "volume",
                "Source": "/var/lib/docker/volumes/54eb0fd9a42db9f4d24f3edcbb6c9f3fcbc6d74029a12b5f5575f8d7998b6445/_data",
            "Volumes": {
-bash-4.2$


On base OS, we can find the container volume on the below path.

[root@manager ~]# ls -ld /var/lib/docker/volumes/54eb0fd9a42db9f4d24f3edcbb6c9f3fcbc6d74029a12b5f5575f8d7998b6445/_data
drwxr-xr-x. 2 root root 20 Nov 30 00:28 /var/lib/docker/volumes/54eb0fd9a42db9f4d24f3edcbb6c9f3fcbc6d74029a12b5f5575f8d7998b6445/_data
[root@manager ~]#

Sharing Volumes between containers:

-bash-4.2$ sudo docker run -it --name second-container-data -h NEWCONTAINER --volumes-from container-data centos /bin/bash
[sudo] password for dockmgr:

[root@NEWCONTAINER /]# df -Ph
Filesystem               Size  Used Avail Use% Mounted on
overlay                   17G  2.9G   15G  17% /
tmpfs                     64M     0   64M   0% /dev
tmpfs                    487M     0  487M   0% /sys/fs/cgroup
shm                       64M     0   64M   0% /dev/shm
/dev/mapper/centos-root   17G  2.9G   15G  17% /data
tmpfs                    487M     0  487M   0% /proc/asound
tmpfs                    487M     0  487M   0% /proc/acpi
tmpfs                    487M     0  487M   0% /proc/scsi
tmpfs                    487M     0  487M   0% /sys/firmware
[root@NEWCONTAINER /]#

[root@NEWCONTAINER /]# cd /data
[root@NEWCONTAINER data]# ls -l
total 4
-rw-r--r--. 1 root root 6 Nov 30 05:28 myfile
[root@NEWCONTAINER data]# cat myfile
hello
[root@NEWCONTAINER data]#



Backup of a volume /data created earlier:


-bash-4.2$ sudo docker run --volumes-from container-data -v $(pwd):/backup centos tar cvf /backup/data.tar /data
[sudo] password for dockmgr:
tar: Removing leading `/' from member names
/data/
/data/myfile
-bash-4.2$ pwd
/home/dockmgr
-bash-4.2$ ls -la
total 12
drwxr-xr-x. 2 root root    22 Nov 30 01:31 .
drwxr-xr-x. 3 root root    21 Nov 28 00:55 ..
-rw-r--r--. 1 root root 10240 Nov 30 01:31 data.tar
-bash-4.2$ tar -tvf data.tar
drwxr-xr-x root/root         0 2019-11-30 00:28 data/
-rw-r--r-- root/root         6 2019-11-30 00:28 data/myfile
-bash-4.2$ sudo tar -xvf data.tar
data/
data/myfile
-bash-4.2$ ls -l
total 12
drwxr-xr-x. 2 root root    20 Nov 30 00:28 data
-rw-r--r--. 1 root root 10240 Nov 30 01:31 data.tar
-bash-4.2$ cd data
-bash-4.2$ ll
total 4
-rw-r--r--. 1 root root 6 Nov 30 00:28 myfile
-bash-4.2$ cat myfile
hello
-bash-4.2$


Pull an image, run it , rename it to usergiven name and attach a shell then create a directory inside it. Exit.. Then start the container and again attach the shell. you will notice the same container ID is available and you can see the directory created in the earlier step. But it will be not available if you create another container from the same image.


-bash-4.2$ docker pull fedora:latest
latest: Pulling from library/fedora
d318c91bf2a8: Pull complete
Digest: sha256:d4f7df6b691d61af6cee7328f82f1d8afdef63bc38f58516858ae3045083924a
Status: Downloaded newer image for fedora:latest
docker.io/library/fedora:latest
-bash-4.2$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
debian              latest              67e34c1c9477        7 days ago          114MB
ubuntu              latest              775349758637        4 weeks ago         64.2MB
fedora              latest              f0858ad3febd        4 weeks ago         194MB
centos              latest              0f3e07c0138f        8 weeks ago         220MB
hello-world         latest              fce289e99eb9        11 months ago       1.84kB
training/webapp     latest              6fae60ef3446        4 years ago         349MB
training/postgres   latest              6fa973bb3c26        5 years ago         365MB

-bash-4.2$ sudo docker run -it fedora
[root@2d16ab33f29e /]# ls -l
total 0
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 bin -> usr/bin
dr-xr-xr-x.   2 root root   6 Jul 25 00:35 boot
drwxr-xr-x.   5 root root 360 Nov 30 06:54 dev
drwxr-xr-x.   1 root root  66 Nov 30 06:54 etc
drwxr-xr-x.   2 root root   6 Jul 25 00:35 home
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 lib -> usr/lib
lrwxrwxrwx.   1 root root   9 Jul 25 00:35 lib64 -> usr/lib64
drwx------.   2 root root   6 Oct 28 05:47 lost+found
drwxr-xr-x.   2 root root   6 Jul 25 00:35 media
drwxr-xr-x.   2 root root   6 Jul 25 00:35 mnt
drwxr-xr-x.   2 root root   6 Jul 25 00:35 opt
dr-xr-xr-x. 122 root root   0 Nov 30 06:54 proc
dr-xr-x---.   2 root root 196 Oct 28 05:48 root
drwxr-xr-x.  13 root root 186 Oct 28 05:48 run
lrwxrwxrwx.   1 root root   8 Jul 25 00:35 sbin -> usr/sbin
drwxr-xr-x.   2 root root   6 Jul 25 00:35 srv
dr-xr-xr-x.  13 root root   0 Nov 30 04:56 sys
drwxrwxrwt.   2 root root  32 Oct 28 05:48 tmp
drwxr-xr-x.  12 root root 144 Oct 28 05:47 usr
drwxr-xr-x.  18 root root 235 Oct 28 05:47 var
[root@2d16ab33f29e /]# exit
exit
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
-bash-4.2$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                         PORTS               NAMES
2d16ab33f29e        fedora              "/bin/bash"              19 seconds ago      Exited (0) 7 seconds ago                           elated_noether


-bash-4.2$ sudo docker rename elated_noether shan_container_fedora
-bash-4.2$
-bash-4.2$ sudo docker start shan_container_fedora
shan_container_fedora
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
2d16ab33f29e        fedora              "/bin/bash"         About a minute ago   Up 9 seconds                            shan_container_fedora
-bash-4.2$ sudo docker attach shan_container_fedora
[root@2d16ab33f29e /]# mkdir testdir
[root@2d16ab33f29e /]# ls -l
total 0
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 bin -> usr/bin
dr-xr-xr-x.   2 root root   6 Jul 25 00:35 boot
drwxr-xr-x.   5 root root 360 Nov 30 06:56 dev
drwxr-xr-x.   1 root root  66 Nov 30 06:54 etc
drwxr-xr-x.   2 root root   6 Jul 25 00:35 home
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 lib -> usr/lib
lrwxrwxrwx.   1 root root   9 Jul 25 00:35 lib64 -> usr/lib64
drwx------.   2 root root   6 Oct 28 05:47 lost+found
drwxr-xr-x.   2 root root   6 Jul 25 00:35 media
drwxr-xr-x.   2 root root   6 Jul 25 00:35 mnt
drwxr-xr-x.   2 root root   6 Jul 25 00:35 opt
dr-xr-xr-x. 123 root root   0 Nov 30 06:56 proc
dr-xr-x---.   1 root root  27 Nov 30 06:54 root
drwxr-xr-x.  13 root root 186 Oct 28 05:48 run
lrwxrwxrwx.   1 root root   8 Jul 25 00:35 sbin -> usr/sbin
drwxr-xr-x.   2 root root   6 Jul 25 00:35 srv
dr-xr-xr-x.  13 root root   0 Nov 30 04:56 sys
drwxr-xr-x.   2 root root   6 Nov 30 06:56 testdir
drwxrwxrwt.   2 root root  32 Oct 28 05:48 tmp
drwxr-xr-x.  12 root root 144 Oct 28 05:47 usr
drwxr-xr-x.  18 root root 235 Oct 28 05:47 var
[root@2d16ab33f29e /]# exit
exit
-bash-4.2$ sudo docker start shan_container_fedora
shan_container_fedora
-bash-4.2$ sudo docker attach shan_container_fedora
[root@2d16ab33f29e /]# ls -l
total 0
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 bin -> usr/bin
dr-xr-xr-x.   2 root root   6 Jul 25 00:35 boot
drwxr-xr-x.   5 root root 360 Nov 30 06:57 dev
drwxr-xr-x.   1 root root  66 Nov 30 06:54 etc
drwxr-xr-x.   2 root root   6 Jul 25 00:35 home
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 lib -> usr/lib
lrwxrwxrwx.   1 root root   9 Jul 25 00:35 lib64 -> usr/lib64
drwx------.   2 root root   6 Oct 28 05:47 lost+found
drwxr-xr-x.   2 root root   6 Jul 25 00:35 media
drwxr-xr-x.   2 root root   6 Jul 25 00:35 mnt
drwxr-xr-x.   2 root root   6 Jul 25 00:35 opt
dr-xr-xr-x. 123 root root   0 Nov 30 06:57 proc
dr-xr-x---.   1 root root  27 Nov 30 06:54 root
drwxr-xr-x.  13 root root 186 Oct 28 05:48 run
lrwxrwxrwx.   1 root root   8 Jul 25 00:35 sbin -> usr/sbin
drwxr-xr-x.   2 root root   6 Jul 25 00:35 srv
dr-xr-xr-x.  13 root root   0 Nov 30 04:56 sys
drwxr-xr-x.   2 root root   6 Nov 30 06:56 testdir
drwxrwxrwt.   2 root root  32 Oct 28 05:48 tmp
drwxr-xr-x.  12 root root 144 Oct 28 05:47 usr
drwxr-xr-x.  18 root root 235 Oct 28 05:47 var
[root@2d16ab33f29e /]# exit
exit
-bash-4.2$ sudo docker run -it fedora
[root@b2ce8dd88a27 /]# ls -l
total 0
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 bin -> usr/bin
dr-xr-xr-x.   2 root root   6 Jul 25 00:35 boot
drwxr-xr-x.   5 root root 360 Nov 30 06:57 dev
drwxr-xr-x.   1 root root  66 Nov 30 06:57 etc
drwxr-xr-x.   2 root root   6 Jul 25 00:35 home
lrwxrwxrwx.   1 root root   7 Jul 25 00:35 lib -> usr/lib
lrwxrwxrwx.   1 root root   9 Jul 25 00:35 lib64 -> usr/lib64
drwx------.   2 root root   6 Oct 28 05:47 lost+found
drwxr-xr-x.   2 root root   6 Jul 25 00:35 media
drwxr-xr-x.   2 root root   6 Jul 25 00:35 mnt
drwxr-xr-x.   2 root root   6 Jul 25 00:35 opt
dr-xr-xr-x. 123 root root   0 Nov 30 06:57 proc
dr-xr-x---.   2 root root 196 Oct 28 05:48 root
drwxr-xr-x.  13 root root 186 Oct 28 05:48 run
lrwxrwxrwx.   1 root root   8 Jul 25 00:35 sbin -> usr/sbin
drwxr-xr-x.   2 root root   6 Jul 25 00:35 srv
dr-xr-xr-x.  13 root root   0 Nov 30 04:56 sys
drwxrwxrwt.   2 root root  32 Oct 28 05:48 tmp
drwxr-xr-x.  12 root root 144 Oct 28 05:47 usr
drwxr-xr-x.  18 root root 235 Oct 28 05:47 var
[root@b2ce8dd88a27 /]# exit
exit
-bash-4.2$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
-bash-4.2$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
b2ce8dd88a27        fedora              "/bin/bash"              31 seconds ago      Exited (0) 23 seconds ago                       hopeful_kepler
2d16ab33f29e        fedora              "/bin/bash"              3 minutes ago       Exited (0) 55 seconds ago                       shan_container_fedora

Deleting a container:

-bash-4.2$ sudo docker rm shan_container_fedora
[sudo] password for dockmgr:
shan_container_fedora
-bash-4.2$ sudo docker ps -a | grep -i fedora
b2ce8dd88a27        fedora              "/bin/bash"              8 minutes ago       Exited (0) 8 minutes ago                        hopeful_kepler
-bash-4.2$

No comments:

Post a Comment

Installation of Jenkins on Linux and Deployment NGINX through Jenkins

Installation of Jenkins: [root@worker1 ~]# useradd -c "jenkins user" jenkins [root@worker1 ~]# passwd jenkins Changing passw...