安装docker、docker-compose
文章目录
- 安装docker、docker-compose
- 一、切换国内镜像源
- 二、安装docker
- 三、安装docker-compose
一、切换国内镜像源
vi /etc/docker/daemon.json
{"registry-mirrors": ["https://registry.hub.docker.com","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com"]
}
二、安装docker
参考官网
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo docker run hello-world
三、安装docker-compose
方式1:参考官网
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
方式2:ChatGPT推荐
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
采用方式1进行安装
执行如下命令
chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
如图验证安装成功
---- 永不磨灭的番号:AK