Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
[1] install Docker.
[root@localhost ~]# dnf install docker -y
[root@localhost ~]# systemctl enable docker
[root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# 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.
[root@localhost ~]# docker run -it futurelinux/future:base /bin/bash
root@d5e2c9b186c7:/# # Container's console
root@d5e2c9b186c7:/# 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
root@d5e2c9b186c7:/# exit
exit
[root@localhost ~]# # come back
[4] If exit from the Container session with keeping container's process, push [Ctrl+p] and [Ctrl+q] key.
[root@localhost ~]# docker run -it futurelinux/future:base /bin/bash
root@d5e2c9b186c7:/# [root@localhost ~]# # Ctrl+p, Ctrl+q
# show docker process
[root@localhost ~]# 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
[root@localhost ~]# docker exec -it 1a29b45be5ac /bin/bash
root@d5e2c9b186c7:/# # just connected
# shutdown container's process from Host's console
[root@localhost ~]# docker kill 1a29b45be5ac
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES