Loading

Docker 安装 和 docker-compose

安装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-compose-plugin

设置开机启动docker

systemctl start docker #启动docker
systemctl enable docker

配置阿里云镜像 - 非常重要

https://cr.console.aliyun.com/cn-qingdao/instances/mirrors

image

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

测试镜像

sudo docker run hello-world

image

image

安装Docker-Compose

curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

# 加上可执行权限
sudo chmod +x /usr/local/bin/docker-compose

查看版本

docker-compose -v
posted @ 2022-06-07 15:56  白日醒梦  阅读(131)  评论(0编辑  收藏  举报