Ubuntu 23.04
Sponsored Link

Docker : Install2023/04/27

 
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
root@dlp:~#
docker version

Client:
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.20.1
 Git commit:        20.10.21-0ubuntu3
 Built:             Tue Feb 28 14:28:22 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.20.1
  Git commit:       20.10.21-0ubuntu3
  Built:            Tue Feb 28 12:17:52 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.12-0ubuntu3
  GitCommit:
 runc:
  Version:          1.1.4-0ubuntu3
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:
[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
2ab09b027e7f: Pull complete
Digest: sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21
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@7920576eacb2:/#    
# Container's console

root@7920576eacb2:/#
uname -a

Linux 7920576eacb2 6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 6 07:48:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@7920576eacb2:/#
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@46bf76beba7a:/# root@dlp:~#    
# Ctrl+p, Ctrl+q
# show docker process

root@dlp:~#
docker ps

CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS          PORTS     NAMES
46bf76beba7a   ubuntu    "/bin/bash"   18 seconds ago   Up 17 seconds             naughty_bassi

# connect to container's session

root@dlp:~#
docker attach 46bf76beba7a

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

root@dlp:~#
docker kill 46bf76beba7a

8e65bd53937d
root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Matched Content