1. 程式人生 > >Docker安裝-yum安裝

Docker安裝-yum安裝

準備環境

安裝docker-ce

安裝必須包:

[[email protected] ~]# yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

配置docker-ce yum源:

[[email protected] ~]# yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

載入yum源:

[[email protected] ~]# yum clean all
[[email protected] ~]# yum makecache

安裝docker-ce:

[[email protected] ~]# yum install -y docker-ce

配置docker開機自動啟動:

[[email protected] ~]# systemctl enable docker

啟動docker:

[[email protected] ~]# systemctl start docker

檢視docker狀態:

[[email protected] ~]# systemctl status docker

驗證docker是否安裝成功:

[[email protected] ~]# docker run hello-world

注意:
出現以下程式碼,表示安裝成功

Hello from Docker!
This message shows that your installation appears to be working correctly.