docker安装(centos)
- 添加代理
[[email protected] ~]# export https_proxy=http://192.168.102.10:8118 [[email protected] ~]# export http_proxy=http://192.168.102.10:8118
- 安装docker repository
根据操作系统选择需要的docker版本
https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce
安装docker仓库需要的组件
yum install -y yum-utils yum install -y device-mapper-persistent-data yum install -y lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
如果上面的安装不了可以换成阿里云的镜像源:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 安装docker-CE(17.03.2版本)
要先安装docker-ce-selinux-17.03.2.ce,否则安装docker-ce会报错
yum install https://download.docker.com/ linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
sudo yum install docker-ce-17.03.2.ce-1.el7.centos
如果遇到问题:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
yum install -y deltarpm
- 启动docker
设置docker开机自动启动
sudo systemctl enable docker
开启docker服务
systemctl start docker
docker安装(Ubuntu)
Ubuntu的由于官方在线安装没有提供历史版本,采用离线安装模式
- 添加代理(如果有需要)
[[email protected] ~]# export https_proxy=http://192.168.102.10:8118 [[email protected] ~]# export http_proxy=http://192.168.102.10:8118
- 安装docker(17.03.2版本)
升级source列表(这里用国内源会比较快,替换源)
vim /etc/apt/sources.list
将该文件中的源替换为网易源(阿里源也可)
deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
开始更新
apt-get update
去官方下载docker二进制文件(.deb)
https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
下载docker所依赖的库文件(https://pkgs.org/)
搜索:libltdl7
下载deb:libltdl7_2.4.6-2_amd64.deb
将这两个deb文件上传到机器的/tmp目录下,并安装deb文件
sudo dpkg -i /tmp/libltdl7_2.4.6-0.1_amd64.deb sudo dpkg -i /tmp/docker-ce_17.03.2_ce-0_ubuntu-xenial_amd64.deb
- 启动docker
设置docker开机自动启动
sudo systemctl enable docker
启动docker服务
systemctl start docker
原文地址:https://www.cnblogs.com/MessChenly/p/9040123.html
时间: 2024-11-08 05:14:57