網頁

2023/10/19

Rocky Linux install docker

參考Rocky Linux官方文件即可。


安裝環境:

  • Rocky Linux 9


安裝

這邊使用dnf(Dandified Yum)套件管理工具安裝。

輸入sudo dnf check-update更新套件。

sudo dnf check-update
Last metadata expiration check: 0:03:28 ago on Fri 20 Oct 2023 01:38:56 PM CST.

輸入sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo設定docker repository。

# sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

輸入sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin安裝 docker和docker compose。

# sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Docker CE Stable - x86_64                                                                                                                                                                                                                        54 kB/s | 3.5 kB     00:00
Package docker-ce-3:24.0.6-1.el9.x86_64 is already installed.
Package docker-ce-cli-1:24.0.6-1.el9.x86_64 is already installed.
Package containerd.io-1.6.24-3.1.el9.x86_64 is already installed.
Package docker-compose-plugin-2.21.0-1.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!


啟動

輸入sudo systemctl start docker啟動docker

# sudo systemctl start docker

輸入sudo systemctl enable docker讓每次系統重啟時會自動啟動docker服務。

# sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

輸入sudo systemctl status docker.service檢視運行狀況。

# sudo systemctl status docker.service
 docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
     Active: active (running) since Fri 2023-10-20 13:49:00 CST; 44s ago
TriggeredBy:  docker.socket
       Docs: https://docs.docker.com
   Main PID: 2503 (dockerd)
      Tasks: 9
     Memory: 32.6M
        CPU: 427ms
     CGroup: /system.slice/docker.service
             └─2503 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock


沒有留言:

張貼留言