docker - 在线安装docker
在线安装 docker,仅供学习使用。
如果在正式环境中,要用离线包进行安装:
- 正式环境一般是在局域网中,根本不会联网;
- 要保证环境统一,所有开发人员使用相同的 docker 版本。
环境:Alibaba Cloud Linux 3.2104 LTS 64位
# 移除历史版本
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
# 安装工具包
yum install -y yum-utils
# 设置软件仓库,推荐使用阿里云的,这是 yum 的仓库,不是 docker 镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 更新 yum 软件包索引
yum makecache
# 安装 docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
# 查看 docker-ce 是否成功安装
dnf list docker-ce
# 启动 Docker 服务。
systemctl start docker
# 查看 Docker 服务的运行状态。active(running)标识运行成功!
systemctl status docker
# 验证效果
# 拉取 hello-world
docker pull hello-world
# 运行 hello-world
docker run hello-world
Docker启停
# 启动 docker
systemctl start docker
# 停止 docker
systemctl stop docker
# 重启 docker
systemctl restart docker
# 查看 docker状态
systemctl status docker
# 开机启动
systemctl enable docker
疯狂的妞妞 :每一天,做什么都好,不要什么都不做!