Docker安装

Docker安装

  • 删除docker
sudo yum remove docker \
   docker-client \
   docker-client-latest \
   docker-common \
   docker-latest \
   docker-latest-logrotate \
   docker-logrotate \
   docker-engine
  • 安装docker
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum -y install docker-ce docker-ce-cli containerd.io
  • centos7中修改docker.service
vi /usr/lib/systemd/system/docker.service 
ExecStart=/usr/bin/dockerd 下面添加如下内容:
--graph=/data/tools/docker
  • 重新加载配置
systemctl daemon-reload 
systemctl restart docker
  • 修改镜像源
vi /etc/docker/daemon.json

{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

安装docker compose

curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# chmod +x 给docker-compose增加执行权限
# 国内源:curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
posted @ 2022-01-19 16:31  杭州红烧肉  阅读(30)  评论(0编辑  收藏  举报