Ubuntu 18.04
Sponsored Link

Docker : Install
2018/06/12
 
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 -i -t ubuntu /bin/bash

root@864190678aa7:/#    
# Container's console

root@864190678aa7:/#
uname -a

Linux 864190678aa7 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@864190678aa7:/#
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 -i -t ubuntu /bin/bash

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

root@dlp:~#
docker ps

CONTAINER ID   IMAGE    COMMAND       CREATED          STATUS           PORTS      NAMES
f8ca55be9b91   ubuntu   "/bin/bash"   32 seconds ago   Up 31 seconds               reverent_wilson

# connect to container's session

root@dlp:~#
docker attach f8ca55be9b91

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

root@dlp:~#
docker kill f8ca55be9b91

f8ca55be9b91
root@dlp:~#
docker ps

CONTAINER ID   IMAGE    COMMAND       CREATED          STATUS           PORTS      NAMES

Matched Content
 
Tweet