国内使用使用阿里云的镜像安装比较快
apt-get update
apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64]
http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
apt-get -y update
apt-get -y install docker-ce
docker run -dp 80:80 docker/getting-started
免sudo设置
sudo gpasswd -a $USER docker
newgrp docker
docker加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://dockerhub.azk8s.cn"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
上面添加的是微软的docker加速镜像,我们也可以添加阿里云的镜像加速器,需要注册阿里云,登陆https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors后可以看到的自己的镜像加速器
安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
或者去https://github.com/docker/compose下载对应的版本。
sudo chmod +x /usr/local/bin/docker-compose
近期评论