阿里云的服务器的安装方式和其他方式都是一样的,只是说会遇到一些错误。
1.看一下自己的系统
[root@VM-4-4-opencloudos ~]# cat /etc/os-release
NAME="OpenCloudOS"
VERSION="8.6"
ID="opencloudos"
ID_LIKE="rhel fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:oc8"
PRETTY_NAME="OpenCloudOS 8.6"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:opencloudos:opencloudos:8"
HOME_URL="https://www.opencloudos.org/"
BUG_REPORT_URL="https://bugs.opencloudos.tech/"
[root@VM-4-4-opencloudos ~]# uname -r
5.4.119-20.0009.20
阿里云官方说的是基于CentOS7.9做的修改。接着我们就按照官方教程开始操作。
2.先执行卸载,或者说以前装过的需要卸载
yum remove docker
3.安装docker的存储驱动依赖
dnf install -y device-mapper-persistent-data lvm2
- 添加稳定的Docker软件源
dnf config-manager --add-repo=https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 如果中间有什么root_.repo错误,请执行以下命令, 将最后一行的 =1 改为 =0
vim /etc/yum.repos.d/root_.repo
6.查看自添加的Docker软件源
dnf list docker-ce
- 安装: ce是社区版,ee你懂得。cli是客户端 io是核心,一些插件,windows默认安装上的
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- 启动
systemctl start docker
- 查看运行状态
systemctl status docker
10.查看版本信息
docker version
- 跑一下hello world
docker run hello-world
ps: 首次执行会下载一个镜像
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:dcba6daec718f547568c562956fa47e1b03673dd010fe6ee58ca806767031d1c
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/
以上就安装好了docker,且有一个镜像。
卸载操作
- 卸载 包括cli 、io 等
yum remove docker-ce
- 删除镜像容器配置文件
rm -rf /var/lib/docker