Ubuntu 24.04
Sponsored Link

Docker : Install2024/06/13

 

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:           24.0.7
 API version:       1.43
 Go version:        go1.22.2
 Git commit:        24.0.7-0ubuntu4
 Built:             Wed Apr 17 20:08:25 2024
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.22.2
  Git commit:       24.0.7-0ubuntu4
  Built:            Wed Apr 17 20:08:25 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.12
  GitCommit:
 runc:
  Version:          1.1.12-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
00d679a470c4: Pull complete
Digest: sha256:e3f92abc0967a6c19d0dfa2d55838833e947b9d74edbcb0113e48535ad4be12a
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@afe78d8181d7:/#    
# Container's console

root@afe78d8181d7:/#
uname -a

Linux afe78d8181d7 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@afe78d8181d7:/#
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@488de36da1de:/# root@dlp:~#    
# Ctrl+p, Ctrl+q
# show docker process

root@dlp:~#
docker ps

CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS          PORTS     NAMES
488de36da1de   ubuntu    "/bin/bash"   30 seconds ago   Up 30 seconds             nervous_newton

# connect to container's session

root@dlp:~#
docker attach 488de36da1de

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

root@dlp:~#
docker kill 488de36da1de

488de36da1de
root@dlp:~#
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Matched Content