centos7安装docker
脚本安装
install_docker.sh
#!/bin/bash
yum install -y yum-utils device-mapper-persistent-data lvm2
yum makecache fast
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce
systemctl start docker
systemctl enable docker
docker version
使用ansible多台主机安装
# 使用script模块在其他主机执行install_docker.sh
ansible all -m script -a /home/install_docker.sh
# 使用shell模块查看是否安装成功
ansible all -m shell -a 'docker ps'

浙公网安备 33010602011771号