CentOs方式文章来源:https://www.toymoban.com/news/detail-694657.html
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo \
&& sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo \
&& yum install docker-ce -y && sudo systemctl --now enable docker && touch /etc/docker/daemon.json \
&& echo "{\"registry-mirrors\":[\"https://mirror.ccs.tencentyun.com\"]}" > /etc/docker/daemon.json \
&& systemctl restart docker && docker run --rm hello-world && docker system prune -a --force
Ubuntu方式文章来源地址https://www.toymoban.com/news/detail-694657.html
sudo apt-get update && sudo apt-get install ca-certificates curl gnupg -y \
&& curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - \
&& sudo add-apt-repository "deb [arch=amd64] https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" -y \
&& sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io -y \
&& sudo systemctl --now enable docker && sudo touch /etc/docker/daemon.json \
&& sudo sh -c 'echo "{\"registry-mirrors\":[\"https://mirror.ccs.tencentyun.com\"]}" > /etc/docker/daemon.json' \
&& sudo systemctl restart docker && sudo docker run --rm hello-world \
&& sudo docker system prune -a --force
到了这里,关于CentOs/Ubuntu 一行指令安装Docker的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!