centos7安装docker-ce

#https://docs.docker.com/install/linux/docker-ce/centos/
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
  
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
sudo yum install docker-ce docker-ce-cli containerd.io -y

sudo systemctl start docker
sudo systemctl enable docker

sudo docker run hello-world

完整shell脚本

#!/bin/bash
#author: chunk
#date: 2019-09-10
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker
yum -y install epel-release vim wget curl yum-utils bash-completion bash-completion-extras  lrzsz telnet 
yum install -y python-pip
pip install --upgrade pip
pip install docker-compose

systemctl enable docker 

systemctl start docker 
systemctl stop docker 
sleep 30

#docker存储目录更改为/home/data/docker
echo '{"graph": "/home/data/docker"}' >/etc/docker/daemon.json

systemctl start docker 

docker system info | grep "Root Dir"

你可能感兴趣的:(centos7安装docker-ce)