1: อัปเดทระบบsudo dnf update -yStep
2: เพิ่ม Docker Repositorysudo dnf config-manager –add-repo=https://download.docker.com/linux/centos/docker-ce.repoStep
3: ติดตั้ง Docker Enginesudo dnf install docker-ce docker-ce-cli containerd.ioStep
4: Start และ Enable Dockersudo systemctl start dockersudo systemctl enable dockerStep
5: ตรวจสอบสถานะและเวอร์ชั่น Dockersudo systemctl status dockersudo docker versiondocker –versionStep
6: เพิ่มผู้ใช้งานsudo usermod -aG docker $USERid $USERrebootStep
7: ทดสอบรัน Docker docker pull hello-world
[root@localhost ~]# docker pull hello-worldUsing default tag: latest
latest: Pulling from library/hello-worldc1ec31eb5944: Pull complete
Digest: sha256:91fb4b041da273d5a3273b6d587d62d518300a6ad268b28628f74997b93171b2
Status: Downloaded newer image for hello-world:latestdocker.io/library/hello-world:latest
docker run -it hello-world
[root@localhost ~]# docker run -it hello-worldHello from Docker!This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub. (amd64)
3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashShare images, automate workflows, and more with a free
Docker ID: https://hub.docker.com/For more examples and ideas, visit: https://docs.docker.com/get-started/—-
Step 8: ตรวจสอบ images filesdocker images—-
[root@localhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhello-world latest d2c94e258dcb 16 months ago 13.3kB
ตรวจสอบโปรเซส docker ps -a
[root@localhost ~]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES7a74bcfc7da7 hello-world “/hello” About a minute ago Exited (0) About a minute ago vibrant_goldwasser
Note.หากต้องการถอนการติดตั้ง Docker ให้สั่งดังนี้
sudo dnf remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo rm -rf /var/lib/dockersudo rm -rf /var/lib/containerd