Ubuntu 20.04
Sponsored Link

Docker : Install
2020/06/02
 
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
[1] Install Docker.
root@dlp:~#
apt -y install docker.io
[2] Download an official image and create a Container and output the words [Welcome to the Docker World] inside the Container.
# download the image

root@dlp:~#
docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
.....
.....
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest

# run echo inside Container

root@dlp:~#
docker run ubuntu /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@dlp:~#
docker run -it ubuntu /bin/bash

root@0c80f908e41e:/#    
# Container's console

root@0c80f908e41e:/#
uname -a

Linux 0c80f908e41e 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@0c80f908e41e:/#
exit

exit
root@dlp:~#    
# come back
[4] If exit from the Container session with keeping container's process, push [Ctrl+p] and [Ctrl+q] key.
root@dlp:~#
docker run -it ubuntu /bin/bash

root@3883a5e11c57:/# root@dlp:~#    
# Ctrl+p, Ctrl+q
# show docker process

root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
3883a5e11c57        ubuntu              "/bin/bash"         19 seconds ago      Up 18 seconds                           youthful_chaplygin

# connect to container's session

root@dlp:~#
docker attach 3883a5e11c57

root@3883a5e11c57:/#
# shutdown container's process from Host's console

root@dlp:~#
docker kill 3883a5e11c57

3883a5e11c57
root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Matched Content