Alibaba Cloud Linux release 3安装Docker
1.前言
闲来无事整了一个阿里云服务器,第一步当然是先把Docker环境安装上,直接打开官方文档开整,官网地址:Install Docker Engine on CentOS | Docker Docs
主要针对Alibaba Cloud Linux 3的64位系统,其他环境的安装命令可能会有部分出入,仅供参考
2.开整
查询系统版本
服务器镜像选择的是阿里云的Alibaba Cloud Linux release 3系统,提供长达10年的支持和维护,关于该系统的描述可参考阿里云官方文档:什么是Alibaba Cloud Linux及其适用范围、费用、维护周期_云服务器 ECS-阿里云帮助中心 (aliyun.com)
lsb_release -a
显示信息如下
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: AlibabaCloud
Description: Alibaba Cloud Linux release 3 (Soaring Falcon)
Release: 3
Codename: SoaringFalcon
移除历史版本(第一次安装可忽略)
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
安装工具包
yum install -y yum-utils
设置镜像仓库,国内推荐使用阿里云镜像仓库地址
yum-config-manager \--add-repo \http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
刷新软件包索引
yum makecache
安装docker
顺便安装了docker-compose,直接安装最新版本(版本是24.0.7)
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
查询docker版本
docker -v
当前时间(23年11月30号)使用的 最新的版本:Docker version 24.0.7
启动服务,并设置开机启动
systemctl start docker
systemctl enable docker
查询服务运行状态
systemctl status docker
喜闻乐见的hello world环节
docker run hello-world
当出现以下时,恭喜安装成功
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:
For more examples and ideas, visit:
3.结语
不积跬步无以至千里