- 安装脚本
# 查看系统信息
uname -a
# 官方安装docker脚本
curl -sSL https://get.docker.com/ | sh
# 安装并配置阿里云镜像
curl -fsSL https://get.docker.com | bash -s docker --mirror aliyun
# 阿里云的安装脚本
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
# DaoCloud 的安装脚本
curl -sSL https://get.daocloud.io/docker | sh
# 查看版本
docker -v
- 配置加速器
systemctl enable docker
启动服务后,编辑
vim /etc/systemd/system/multi-user.target.wants/docker.service
在这一行最后添加加速器地址 ExecStart=, eg:
ExecStart=/usr/bin/dockerd --registry-mirror=https://jxus37ad.mirror.aliyuncs.com
重新加载配置并且重新启动。
sudo systemctl daemon-reload
sudo systemctl restart docker
账号登录
docker login --username [username]
- 同步时间
# 手动设置
date -s "20210718 22:00:00"
# 网络同步
sudo yum install ntpdate -y
sudo ntpdate cn.pool.ntp.org
- 报错
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
systemctl daemon-reload
sudo service docker restart
sudo service docker status