76-CentOS Docker 安裝

認真的coder發表於2022-11-23

curl -sSL https://get.daocloud.io/docker | sh

另外一種:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

手動安裝:

sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
sudo yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安裝 Docker Engine-Community

sudo yum install docker-ce docker-ce-cli containerd.io

安裝完,啟動:
sudo systemctl start docker

開啟 vi /etc/docker/daemon.json(若沒有自行建立)

{
    "registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}

重啟一下docker

systemctl restart docker

停止docker程式:

systemctl stop docker

安裝 Docker Compose:

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

將可執行許可權應用於二進位制檔案:

sudo chmod +x /usr/local/bin/docker-compose

建立軟鏈:

 sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

測試是否安裝成功:

docker-compose --version