linux下安装docker
1.安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
2.设置阿里云镜像
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.安装docker-ce
yum install docker-ce
4.启动docker
systemctl start docker#systemctl enable docker 加入开机启动
5.建立docker用户组
groupadd docker #添加当前用户到docker用户组 usermod -aG docker $USER
6.设置阿里云镜像加速
mkdir -p /etc/docker && touch /etc/docker/daemon.json #录入以下内容 { "registry-mirrors": ["加速器地址"] } systemctl daemon-reload systemctl restart docker
7.安装docker-compose
wget -L https://github.com/docker/compose/releases/download/1.25.4/run.sh > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version #等待输出即表示安装成功 Unable to find image ‘docker/compose:1.25.4‘ locally 1.25.4: Pulling from docker/compose 89d9c30c1d48: Pull complete eccc02a3b135: Pull complete 7382d3c5d78f: Pull complete f410c750fbcb: Pull complete Digest: sha256:390bdf3da99a622f5c11f4db386dd97f2858db30cfed07d000b867f1fb25b2f7 Status: Downloaded newer image for docker/compose:1.25.4 docker-compose version 1.25.4, build 8d51620