docker之Hello-world

**在centos上安装docker**

cat /etc/redhat-release
-- uname -r : 显示操作系统的发行版号
-- uname -a :显示系统名、节点名称、操作系统的发行版号、内核版本等等。
uname -r

 

1.卸载老版本 

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2.下载依赖

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3.配置加速器

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

4.开始安装

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

5.启动docker

sudo systemctl start docker

6.设置开机启动

sudo systemctl enable docker

7.验证是否安装成功

sudo docker run hello-world

参考官方文档:https://docs.docker.com/engine/install/centos/

posted on 2023-02-24 14:07  芫霸  阅读(56)  评论(0编辑  收藏  举报