Install Docker

Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.

[1] install Docker.

[[email protected] ~]# dnf install docker -y
[[email protected] ~]# systemctl enable docker
[[email protected] ~]# systemctl start docker

[2] Download an official image and create a Container and output the words [Welcome to the Docker World] inside the Container.

# download official image
[[email protected] ~]# docker pull futurelinux/future:base
Trying to pull repository docker.io/futurelinux/future ...
sha256:00edda7b814d5bc034049bb05acfa2dc8620287d4bc43aeac7548c16c0d5567c: Pulling from docker.io/futurelinux/future
22b432ba4735: Pull complete
Digest: sha256:00edda7b814d5bc034049bb05acfa2dc8620287d4bc43aeac7548c16c0d5567c
Status: Downloaded newer image for docker.io/futurelinux/future:base

# run echo inside Container
[[email protected] ~]# docker run futurelinux/future:base /bin/echo "Welcome to the Docker World"
Welcome to the Docker World

[3] Connect to the interactive session of a Container with [i] and [t] option like follows. If exit from the Container session, the process of a Container finishes.

[[email protected] ~]# docker run -it futurelinux/future:base /bin/bash
[email protected]:/#     # Container's console
[email protected]:/# uname -a
Linux d5e2c9b186c7 5.10.39-300.fx1.x86_64 #1 SMP Sun May 23 01:08:57 +03 2021 x86_64 x86_64 x86_64 GNU/Linux

[email protected]:/# exit
exit
[[email protected] ~]#     # come back

[4] If exit from the Container session with keeping container's process, push [Ctrl+p] and [Ctrl+q] key.

[[email protected] ~]# docker run -it futurelinux/future:base /bin/bash
[email protected]:/# [[email protected] ~]#     # Ctrl+p, Ctrl+q

# show docker process
[[email protected] ~]# docker ps
CONTAINER ID    IMAGE                    COMMAND       CREATED          STATUS       PORTS     NAMES
1a29b45be5ac    futurelinux/future:base  "/bin/bash"   45 seconds ago   Up 45 seconds        keen_visvesvaraya

# connect to container's session
[[email protected] ~]# docker exec -it 1a29b45be5ac /bin/bash
[email protected]:/#     # just connected

# shutdown container's process from Host's console
[[email protected] ~]# docker kill 1a29b45be5ac
[[email protected] ~]# docker ps
CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES