在线安装
配置yum安装源
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum安装docker
yum -y install docker-ce-18.06.1.ce-3.el7
docker --version
离线安装
docker安装包下载:
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.09.8-3.el7.x86_64.rpm
依赖包下载:
containerd.io:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.el7.x86_64.rpm
docker-ce-cli:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-18.09.8-3.el7.x86_64.rpm
container-selinux:https://pkgs.org/download/container-selinux
离线安装
rpm -ivh docker-ce-cli-18.09.8-3.el7.x86_64.rpm
rpm -ivh container-selinux-2.107-3.el7.noarch.rpm
rpm -ivh containerd.io-1.2.2-3.el7.x86_64.rpm
rpm -ivh docker-ce-18.09.8-3.el7.x86_64.rpm
启动docker
systemctl enable docker && systemctl start docker
1 docker默认镜像源位于国外,下载速度较慢,建议修改配置文件daemon.json,若无则新建。
2 使用命令查看镜像源:cat /etc/docker/daemon.json,如果没有该文件或没有配置,则镜像源位于国外。
3 修改daemon.json
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://onozxvpe.mirror.aliyuncs.com","http://hub-mirror.c.163.com", "https://registry.docker-cn.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
桌面建一个Hyper-V.bat文件
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
把代码复制到Hyper-V.bat里面
点击Hyper-V.bat开始安装
Linux安装:
【环境搭建】Docker镜像相关操作(切换镜像源、查询、获取、查看、创建、上传、保存、删除等) - 范斯猫
Windows安装
安装过程遇到问题:
centos 安装docker报错 [Errno 14] HTTPS Error 502 - Bad Gateway - 范斯猫