Ubuntu 19.04
Sponsored Link

Docker : Install2019/04/25

 
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

# 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@1433394473ec:/#    
# Container's console

root@1433394473ec:/#
uname -a

Linux 1433394473ec 5.0.0-13-generic #14-Ubuntu SMP Mon Apr 15 19:59:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@1433394473ec:/#
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@4392470d9370:/# root@dlp:~#    
# Ctrl+p, Ctrl+q
# show docker process

root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
4392470d9370        ubuntu              "/bin/bash"         16 seconds ago      Up 14 seconds                           cocky_banach

# connect to container's session

root@dlp:~#
docker attach 4392470d9370

root@4392470d9370:/#
# shutdown container's process from Host's console

root@dlp:~#
docker kill 4392470d9370

4392470d9370
root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Matched Content