PolarSPARC |
Introduction to Docker
Bhaskar S | *UPDATED*03/16/2025 |
Overview
Docker is a platform for developers and administrators to develop, build, deploy, and run applications. In other words, think of Docker as an application level virtualization, that allows multiple isolated instances of an application and its dependencies (configuration, files, and libraries) to run on a single host that are isolated from one another.
The Docker platform under-the-hood leverages some of the Linux kernel functionality such as namespaces, cgroups, capabilities, etc via an API interface called libcontainer to provide application level virtualization.
The following Figure-1 illustrates the high-level overview of a Docker:
Docker uses a client-server model, where a background daemon server process manages the application containers and a remote client process communicates and interacts with the daemon process relaying user commands to build, deploy, or run application containers.
The core components that make Docker are as follows:
Docker Daemon :: server process manages the application containers
Docker Client :: client process that communicates with the daemon for relaying user commands
Docker Container :: a package for an application and its resources. Think of the Docker Container as a "application in a box" with its own resources such as files, libraries, and binaries
Docker Image :: is an immutable read-only template for a Docker Container . Think of the Docker Image as a "snapshot" for a Docker Container
Docker Registry :: a repository for holding Docker Images. The public Docker Registry hosted by Docker community in the cloud is referred to as the Docker Hub and contains a large collection of ready to use Docker Images
In short, build a Docker Image to package an application, create a Docker Container from the Docker Image to run the application, and share the Docker Image via the Docker Registry.
Installation
The installation is on a Ubuntu 24.04 LTS based Linux desktop.
To refresh the package index files on the Linux system, execute the following command in a terminal window:
$ sudo apt-get update
To ensure the pre-requisite certs and utilities are installed, execute the following command in a terminal window:
$ sudo apt-get install -y ca-certificates curl
The following should be the typical output:
Reading package lists... Done Building dependency tree... Done Reading state information... Done ca-certificates is already the newest version (20240203). curl is already the newest version (8.5.0-2ubuntu10.6). 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
To ensure valid Docker cryptographic keys are setup, execute the following commands in a terminal window:
$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
$ sudo chmod a+r /etc/apt/keyrings/docker.asc
There is no output generated.
To add the Docker package repository, execute the following command in a terminal window:
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
There is no output generated.
Once again, to refresh the package index files on the Linux system, execute the following command in a terminal window:
$ sudo apt-get update
To install Docker on the system, execute the following command in a terminal window:
$ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
The following should be the typical trimmed output:
...[TRIM]... The following additional packages will be installed: docker-ce-rootless-extras git git-man liberror-perl libslirp0 pigz slirp4netns Suggested packages: cgroupfs-mount | cgroup-lite git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn The following NEW packages will be installed: containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin git git-man liberror-perl libslirp0 pigz slirp4netns ...[TRIM]... Setting up liberror-perl (0.17029-2) ... Setting up docker-buildx-plugin (0.21.1-1~ubuntu.24.04~noble) ... Setting up containerd.io (1.7.25-1) ... Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /usr/lib/systemd/system/containerd.service. Setting up docker-compose-plugin (2.33.1-1~ubuntu.24.04~noble) ... Setting up docker-ce-cli (5:28.0.1-1~ubuntu.24.04~noble) ... Setting up libslirp0:amd64 (4.7.0-1ubuntu3) ... Setting up pigz (2.8-1) ... Setting up git-man (1:2.43.0-1ubuntu7.2) ... Setting up docker-ce-rootless-extras (5:28.0.1-1~ubuntu.24.04~noble) ... Setting up slirp4netns (1.2.1-1build2) ... Setting up docker-ce (5:28.0.1-1~ubuntu.24.04~noble) ... Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service. Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /usr/lib/systemd/system/docker.socket. Setting up git (1:2.43.0-1ubuntu7.2) ... Processing triggers for man-db (2.12.0-4build2) ... Processing triggers for libc-bin (2.39-0ubuntu8.4) ...
To add the logged in user to the docker system group, execute the following commands in a terminal window:
$ sudo groupadd docker
$ sudo usermod -aG docker $(whoami)
To reboot the system, execute the following command in a terminal window:
$ sudo shutdown -r now
Once the system is up (after the reboot), execute the following command in a terminal window:
$ docker info
The following should be the typical trimmed output:
Client: Docker Engine - Community Version: 28.0.1 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.21.1 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.33.1 Path: /usr/libexec/docker/cli-plugins/docker-compose Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 28.0.1 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb runc version: v1.2.4-0-g6c52b3f init version: de40ad0 Security Options: apparmor seccomp Profile: builtin cgroupns Kernel Version: 6.8.0-55-generic Operating System: Linux Mint 22 OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.601GiB Name: mpc-5105 ID: f80f03d2-da81-4a23-b425-511500fd894d Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries: ::1/128 127.0.0.0/8 Live Restore Enabled: false
With this, we complete the installation of the Docker platform on the Linux system.
Hands-on with Docker
To list all the Docker Images on the local host, execute the following command in the terminal window:
$ docker images
The following would be a typical output:
REPOSITORY TAG IMAGE ID CREATED SIZE
From the Output.4 above, we see currently there are no Docker Images on the local host.
To fetch a pre-built Docker Image for Ubuntu 24.04 from Docker Hub registry and store it on the local host, execute the following command in the terminal window:
$ docker pull ubuntu:24.04
Notice the use of the image name followed by the desired version ubuntu:24.04 for Ubuntu 24.04 in the command above.
The following would be a typical output:
24.04: Pulling from library/ubuntu 5a7813e071bf: Pull complete Digest: sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 Status: Downloaded newer image for ubuntu:24.04 docker.io/library/ubuntu:24.04
Onec again, to list all the docker images on the local host, execute the following command in the terminal window:
$ docker images
The following would be a typical output:
REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 24.04 a04dc4851cbc 6 weeks ago 78.1MB
We have downloaded the pre-built Docker Images from the public Docker Hub registry for a specific version of Ubuntu. To create a Docker Container and bring it to life, we need to run the desired Docker Image.
Is this confusing ???
An analogy to Java will make this concept clear.
A Docker Image is like a Java class file - it is built (compiled) and ready to be used. A Docker Container is like a live object instance of the Java class at runtime.
To create and launch our first Docker Container for Ubuntu 24.04 from the just downloaded and locally stored Docker Image, execute the following command in the terminal window:
$ docker run -i -t ubuntu:24.04 /bin/bash
The following would be a typical output:
root@0e3e8a81b479:/#
The -i option indicates we want to run the container in an interactive mode and keep the standard input (STDIN) open from the container.
The -t option instructs Docker to assign a pseudo terminal so that we can interact with the container.
One could also use the associated image id a04dc4851cbc to create and launch the Ubuntu 24.04 Docker Container as shown below:
$ docker run -i -t a04dc4851cbc /bin/bash
Hooray !!! we have successfully created and launched our first Docker Container .
To list all the running Docker Containers, execute the following command in the terminal window:
$ docker ps
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0e3e8a81b479 ubuntu:24.04 "/bin/bash" 3 minutes ago Up 3 minutes brave_sinoussi
Notice that Docker by default assigns a random host name for the running instance of the Docker Container, which in our case is 0e3e8a81b479.
To specify a hostname name dragon to the Docker Container, we can execute the following command:
$ docker run -it --hostname dragon ubuntu:24.04 /bin/bash
The following would be a typical output:
root@dragon:/#
To stop the running Docker Container with the container id 0e3e8a81b479, execute the following command in the containers shell:
root@0e3e8a81b479:/# exit
Alternatively, to stop the running Docker Container with the container id 0e3e8a81b479, we could execute the following command in a terminal window:
$ docker stop 0e3e8a81b479
Once again, to list all the running containers, execute the following command in the terminal window:
$ docker ps
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
As can be observed from the Output.10 above, there are currently no actively running containers at this time.
To list all the Docker Containers, including the ones that are stopped, execute the following command in the terminal window:
$ docker ps -a
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0e3e8a81b479 ubuntu:24.04 "/bin/bash" 10 minutes ago Exited (0) 2 minutes ago brave_sinoussi
To restart the currently stopped Docker Container with the container ID of 0e3e8a81b479, execute the following command the terminal window:
$ docker start 0e3e8a81b479
The above command will restart the Docker Container with the same options as was started the first time.
The following would be a typical output:
0e3e8a81b479
What happened here ??? There is no interactive shell ???
RELAX !!!
We need to attach to the running Docker Container with the container ID 0e3e8a81b479 to be able to access the interactive shell. This is why the options -i and -t are important.
To attach to the currently running Docker Container with the container ID 0e3e8a81b479, execute the following command in a terminal window:
$ docker attach 0e3e8a81b479
The following would be a typical output:
root@0e3e8a81b479:/#
To delete the currently stopped Docker Container with the container name 0e3e8a81b479, execute the following command in the terminal window:
$ docker rm 0e3e8a81b479
The following would be a typical output:
0e3e8a81b479
Once again, to list all the containers (even stopped ones), execute the following command in the terminal window:
$ docker ps -a
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
To delete the locally stored Docker Image with the image name a04dc4851cbc associated with Ubuntu 24.04, execute the following command in the terminal window:
$ docker rmi a04dc4851cbc -f
The following would be a typical output:
Untagged: ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 Deleted: sha256:a04dc4851cbcbb42b54d1f52a41f5f9eca6a5fd03748c3f6eb2cbeb238ca99bd Deleted: sha256:4b7c01ed0534d4f9be9cf97d068da1598c6c20b26cb6134fad066defdb6d541d
Once again, to list all the images, execute the following command in the terminal window:
$ docker images
The following would be a typical output:
REPOSITORY TAG IMAGE ID CREATED SIZE
Let us now fetch the pre-built Docker Image for the latest version of Alma Linux (the alternative for CentOS) from Docker Hub registry and store it on the local host by executing the following command in the terminal window:
$ docker pull almalinux:latest
The following would be a typical output:
latest: Pulling from library/almalinux b73550e68465: Pull complete Digest: sha256:787a2698464bf554d02aeeba4e0b022384b21d1419511bfb033a2d440d9f230c Status: Downloaded newer image for almalinux:latest docker.io/library/almalinux:latest
Once again, to list all the Docker Images on the local host, execute the following command in the terminal window:
$ docker images
The following would be a typical output:
REPOSITORY TAG IMAGE ID CREATED SIZE almalinux latest df3270cc8bc8 9 days ago 209MB
To display detailed information for the Docker Image of Alma Linux using the image ID, execute the following command in the terminal window:
$ docker image inspect df3270cc8bc8
The following would be a typical output:
[ { "Id": "sha256:df3270cc8bc827856429f170b5aeb1d91ec7baa88972b3f2ddb44d85f9b7becc", "RepoTags": [ "almalinux:latest" ], "RepoDigests": [ "almalinux@sha256:787a2698464bf554d02aeeba4e0b022384b21d1419511bfb033a2d440d9f230c" ], "Parent": "", "Comment": "buildkit.dockerfile.v0", "Created": "2025-03-07T08:10:42Z", "DockerVersion": "", "Author": "", "Config": { "Hostname": "", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/bash" ], "Image": "", "Volumes": null, "WorkingDir": "/", "Entrypoint": null, "OnBuild": null, "Labels": null }, "Architecture": "amd64", "Os": "linux", "Size": 209142424, "GraphDriver": { "Data": { "MergedDir": "/var/lib/docker/overlay2/8deae19421c7f5ce78a949227a64c6e8ee44c1a96bea340486ac23f391101533/merged", "UpperDir": "/var/lib/docker/overlay2/8deae19421c7f5ce78a949227a64c6e8ee44c1a96bea340486ac23f391101533/diff", "WorkDir": "/var/lib/docker/overlay2/8deae19421c7f5ce78a949227a64c6e8ee44c1a96bea340486ac23f391101533/work" }, "Name": "overlay2" }, "RootFS": { "Type": "layers", "Layers": [ "sha256:9f12f5d8dbb04839f3c671b0d37ed7b12d1865575905016a48d0e0cd6ec02789" ] }, "Metadata": { "LastTagTime": "0001-01-01T00:00:00Z" } } ]
To create and launch a Docker Container for the just downloaded Alma Linux, execute the following command in the terminal window:
$ docker run -i -t df3270cc8bc8 /bin/bash
Notice the use of the image id df3270cc8bc8 for Alma Linux in the command above.
The following would be a typical output:
[root@b4aa90a906cc /]#
To list all the running Docker Containers, execute the following command in the terminal window:
$ docker ps
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b4aa90a906cc df3270cc8bc8 "/bin/bash" 38 seconds ago Up 38 seconds kind_goldstine
To list all the process(es) running inside the Docker Container with container id b4aa90a906cc, execute the following command in a terminal window:
$ docker top b4aa90a906cc
Notice the use of the container id b4aa90a906cc in the command above.
The following would be a typical output:
UID PID PPID C STIME TTY TIME CMD root 2165 2145 0 15:39 pts/0 00:00:00 /bin/bash
Let us now try to launch the simple text editor nano inside the container with id b4aa90a906cc by executing the following command in the container terminal:
[root@b4aa90a906cc /]# nano
The following would be a typical output:
bash: nano: command not found
From the Output.23 above, it is evident that nano is not installed in the container with id b4aa90a906cc.
To install nano inside the container with id b4aa90a906cc, execute the following command in the container terminal:
root@b4aa90a906cc:/# dnf install -y nano
The following would be a typical output:
AlmaLinux 9 - AppStream 20 MB/s | 14 MB 00:00 AlmaLinux 9 - BaseOS 19 MB/s | 15 MB 00:00 AlmaLinux 9 - Extras 42 kB/s | 13 kB 00:00 Dependencies resolved. ==================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================== Installing: nano x86_64 5.6.1-6.el9 baseos 691 k Transaction Summary ==================================================================================================================================== Install 1 Package Total download size: 691 k Installed size: 2.7 M Downloading Packages: nano-5.6.1-6.el9.x86_64.rpm 3.4 MB/s | 691 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------ Total 1.9 MB/s | 691 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : nano-5.6.1-6.el9.x86_64 1/1 Running scriptlet: nano-5.6.1-6.el9.x86_64 1/1 Verifying : nano-5.6.1-6.el9.x86_64 1/1 Installed: nano-5.6.1-6.el9.x86_64 Complete!
Now one should be able to launch nano inside the container with id b4aa90a906cc.
Since we have made changes (installed nano) to the container with id b4aa90a906cc, we need to save the container state as a new Docker Image so we can launch a container with the same state in the future.
To save the currently running Docker Container with container id b4aa90a906cc as a new Docker Image, execute the following command in a terminal window:
$ docker commit b4aa90a906cc myalmalinux
Notice the use of the container id b4aa90a906cc in the command above.
The name of the new Docker Image will be called myalmalinux.
The following would be a typical output:
sha256:620d902516e86fb12d9246d7ee0f1a7b533a8f83284f9ef18a745065e9e557c1
Once again, to list all the Docker Images on the local host, execute the following command in the terminal window:
$ docker images
The following would be a typical output:
REPOSITORY TAG IMAGE ID CREATED SIZE myalmalinux latest 620d902516e8 About a minute ago 274MB almalinux latest df3270cc8bc8 9 days ago 209MB
As is evident from the Output.27, we have successfully created a new Docker Image with the name myalmalinux in the local repository.
Launching a new Docker Container using the image id 620d902516e8 will launch a Alma Linux container with nano installed.
By default, a Docker Container's state is persisted even after the container has exited.
To list all the Docker Containers, including the ones that have exited, execute the following command in the terminal window:
$ docker ps -a
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8b90e1545c6c 620d902516e8 "/bin/bash" About a minute ago Exited (0) 51 seconds ago xenodochial_buck b4aa90a906cc df3270cc8bc8 "/bin/bash" 20 minutes ago Exited (0) About a minute ago kind_goldstine
If we launch a lot of short-lived containers, over time this behavior can fill-up the host filesystem space. One can manually clean-up the filesystem of all the stopped containers state, using the following command:
$ docker rm 8b90e1545c6c b4aa90a906cc
To automatically clean-up the Docker Container's state after the container exits, specify the --rm option as shown below:
$ docker run -it --rm myalmalinux /bin/bash
One caveat with the --rm option - it is mutually exclusive with the -d (background daemon) option.
To list all the running Docker Containers, execute the following command in the terminal window:
$ docker ps
The following would be a typical output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 586e511fc6e5 myalmalinux "/bin/bash" About an hour ago Up About an hour zen_elgamal
To display detailed information (including network details) on the running Docker Container for the container id 586e511fc6e5, execute the following command in the terminal window:
$ docker inspect 586e511fc6e5
The following would be a typical output:
[ { "Id": "586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06", "Created": "2025-03-16T20:20:48.588150232Z", "Path": "/bin/bash", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 2665, "ExitCode": 0, "Error": "", "StartedAt": "2025-03-16T20:20:48.61999449Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:620d902516e86fb12d9246d7ee0f1a7b533a8f83284f9ef18a745065e9e557c1", "ResolvConfPath": "/var/lib/docker/containers/586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06/resolv.conf", "HostnamePath": "/var/lib/docker/containers/586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06/hostname", "HostsPath": "/var/lib/docker/containers/586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06/hosts", "LogPath": "/var/lib/docker/containers/586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06/586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06-json.log", "Name": "/zen_elgamal", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "docker-default", "ExecIDs": null, "HostConfig": { "Binds": null, "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "bridge", "PortBindings": {}, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": true, "VolumeDriver": "", "VolumesFrom": null, "ConsoleSize": [ 42, 132 ], "CapAdd": null, "CapDrop": null, "CgroupnsMode": "private", "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "private", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": [], "BlkioDeviceWriteBps": [], "BlkioDeviceReadIOps": [], "BlkioDeviceWriteIOps": [], "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DeviceRequests": null, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": null, "PidsLimit": null, "Ulimits": [], "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0, "MaskedPaths": [ "/proc/asound", "/proc/acpi", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/proc/scsi", "/sys/firmware", "/sys/devices/virtual/powercap" ], "ReadonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "ID": "586e511fc6e5b7d169e8e0ef49f7ae1300562e95137e517aa96323fec0917e06", "LowerDir": "/var/lib/docker/overlay2/8583d587ec2a61e10a31c45d0da3aae23f7df83bfd18b45012dd60f857e92a5b-init/diff:/var/lib/docker/overlay2/f33d7c5916a7420aa2c141f458144aa4bcffd3b045db5b1ce726d972b595b894/diff:/var/lib/docker/overlay2/8deae19421c7f5ce78a949227a64c6e8ee44c1a96bea340486ac23f391101533/diff", "MergedDir": "/var/lib/docker/overlay2/8583d587ec2a61e10a31c45d0da3aae23f7df83bfd18b45012dd60f857e92a5b/merged", "UpperDir": "/var/lib/docker/overlay2/8583d587ec2a61e10a31c45d0da3aae23f7df83bfd18b45012dd60f857e92a5b/diff", "WorkDir": "/var/lib/docker/overlay2/8583d587ec2a61e10a31c45d0da3aae23f7df83bfd18b45012dd60f857e92a5b/work" }, "Name": "overlay2" }, "Mounts": [], "Config": { "Hostname": "586e511fc6e5", "Domainname": "", "User": "", "AttachStdin": true, "AttachStdout": true, "AttachStderr": true, "Tty": true, "OpenStdin": true, "StdinOnce": true, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/bash" ], "Image": "myalmalinux", "Volumes": null, "WorkingDir": "/", "Entrypoint": null, "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "3f338adcd9eb150652271adcbd7ce46717248a89067ee0fa52579c487b51f810", "SandboxKey": "/var/run/docker/netns/3f338adcd9eb", "Ports": {}, "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "e717fff175990c9f6c87f02e725826eea1d005fdbb1161b8768d88e7e4d11317", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "1a:6d:24:bf:f9:68", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "MacAddress": "1a:6d:24:bf:f9:68", "DriverOpts": null, "GwPriority": 0, "NetworkID": "2617609b5d85e180924b4bb820117a4ea9380acb9f0fc9d3256b8b6b752bd808", "EndpointID": "e717fff175990c9f6c87f02e725826eea1d005fdbb1161b8768d88e7e4d11317", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "DNSNames": null } } } } ]
As is evident from the Output.30 above, the Docker Container for Alma Linux has an ip address of 172.17.0.2.
With this, we conclude that Docker enables one to quickly assemble applications as a container, deploy and run the container (with the applications) in any environment faster.
References