CentOS8にdockerをインストールする

環境
# cat /etc/redhat-release
CentOS Stream release 8

操作方法
1.リポジトリを追加します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
repo の追加: https://download.docker.com/linux/centos/docker-ce.repo
# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo repo の追加: https://download.docker.com/linux/centos/docker-ce.repo
# dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
repo の追加: https://download.docker.com/linux/centos/docker-ce.repo

2.リポジトリ確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf repolist
repo id repo の名前
appstream CentOS Stream 8 - AppStream
baseos CentOS Stream 8 - BaseOS
docker-ce-stable Docker CE Stable - x86_64
# dnf repolist repo id repo の名前 appstream CentOS Stream 8 - AppStream baseos CentOS Stream 8 - BaseOS docker-ce-stable Docker CE Stable - x86_64
# dnf repolist
repo id                            repo の名前
appstream                          CentOS Stream 8 - AppStream
baseos                             CentOS Stream 8 - BaseOS
docker-ce-stable                   Docker CE Stable - x86_64

3.dockerをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf install --nobest --allowerasing docker-ce
# dnf install --nobest --allowerasing docker-ce
# dnf install --nobest --allowerasing docker-ce

4.dockerバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# docker --version
Docker version 20.10.21, build baeda1f
# docker --version Docker version 20.10.21, build baeda1f
# docker --version
Docker version 20.10.21, build baeda1f

5.docker起動と自動起動設定

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
# systemctl start docker
# systemctl enable docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service. # systemctl start docker
# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
# systemctl start docker

スタータスを確認します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres>
Active: active (running) since Fri 2022-11-11 18:07:52 EST; 7s ago
# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres> Active: active (running) since Fri 2022-11-11 18:07:52 EST; 7s ago
# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres>
   Active: active (running) since Fri 2022-11-11 18:07:52 EST; 7s ago

 

CentOS Stream 8

Posted by arkgame