Fedora 23
Sponsored Link

Docker : Install
2015/11/12
 
Install Docker which is the Software Containers Tool.
[1] Install Docker.
[root@dlp ~]#
dnf -y install docker
[root@dlp ~]#
systemctl start docker

[root@dlp ~]#
systemctl enable docker

[2] Download an official image and create a Container and also output the words "Welcome to the Docker World" from the Container.
[root@dlp ~]#
docker run fedora /bin/echo "Welcome to the Docker World"

Unable to find image 'fedora:latest' locally
Trying to pull repository docker.io/library/fedora ... latest: Pulling from library/fedora
b0082ba983ef: Pull complete
...
...
Welcome to the Docker World    
# just executed
[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 finishs.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

[root@9055dd88bbdc /]#    
# just connected
[root@9055dd88bbdc /]#
uname -a

Linux 9055dd88bbdc 4.2.5-300.fc23.x86_64 #1 SMP Tue Oct 27 04:29:56 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@9055dd88bbdc /]#
exit

exit
[root@dlp ~]#    
# be back
[4] If you'd like to exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

[root@8bc4775e1276 /]# [root@dlp ~]#    
# Ctrl+p, Ctrl+q to be back to Host's console
# show docker process

[root@dlp ~]#
docker ps

CONTAINER ID   IMAGE   COMMAND      CREATED         STATUS          PORTS  NAMES
8bc4775e1276   fedora  "/bin/bash"  41 seconds ago  Up 39 seconds          lonely_blackwell

# connect to container's session

[root@dlp ~]#
docker attach 8bc4775e1276

[root@8bc4775e1276 /]#    
# connected
# shutdown container's process from Host's console

[root@dlp ~]#
docker kill 8bc4775e1276

8bc4775e1276
[root@dlp ~]#
docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES
Matched Content
 
Tweet