Docker安装

Ubuntu安装Docker

1、sudo apt-get update

2、sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
    

3、curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg	#官方的

curl -fsSL https://repo.huaweicloud.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -	#更改为华为的

4、echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null		#官方的

sudo add-apt-repository "deb [arch=amd64] https://repo.huaweicloud.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"	#更改为华为的
  
 5、sudo apt-get update
  
 6、sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  
 7、启动docker
  sudo service docker start
  
  8、hello-world
  sudo docker run hello-world

华为云镜像加速

sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://XXX.mirror.aliyuncs.com"]
}
EOF

sudo systemctl daemon-reload

sudo systemctl restart docker
posted @ 2022-11-07 16:04  七侠镇缁衣铺头  阅读(49)  评论(0编辑  收藏  举报