随笔 - 84  文章 - 0  评论 - 0  阅读 - 44403

Docker安装笔记

Docker安装笔记

1.卸载旧版本

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

2.安装依赖设置yum仓库

安装依赖:

yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

3.设置仓库:

yum-config-manager \
  --add-repo \
  http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

或者执行下面代码:

sudo yum install -y yum-utils

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

  1. 安装docker

yum install docker-ce docker-ce-cli containerd.io
  1. 启动并加入开机启动

systemctl start docker
systemctl enable docker

6.验证是否安装成功

docker version
docker run hello-world
[root@localhost etc]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/

7.卸载 docker

删除安装包:

yum remove docker-ce

删除镜像、容器、配置文件等内容:

rm -rf /var/lib/docker
posted on   忆华灯纵博  阅读(114)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2017-10-17 【javascript】JS实例——鼠标操作
2017-10-17 【javascript】JS类型
2017-10-17 【javascript】JS类型——String
2017-10-17 【javascript】JS类型——Boolean
2017-10-17 【javascript】JS类型——Null
2017-10-17 【javascript】JS类型——Undefined
2017-10-17 【javascript】undefined null 0 false void(0) NaN 空字符串 比较
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示