“Docker and docker-compose快速安装”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
 
(未显示同一用户的30个中间版本)
第3行: 第3行:
  
 
[[Docker 镜像瘦身优化]]
 
[[Docker 镜像瘦身优化]]
 +
 +
 +
[https://gitee.com/zhengqingya/docker-compose/tree/master docker-compose安装所有常用服务]
  
 
=[[Docker国内镜像的配置及使用]]=
 
=[[Docker国内镜像的配置及使用]]=
第9行: 第12行:
  
 
=docker on cenos7=
 
=docker on cenos7=
<pre>#install docker
+
<pre>#install docker 如果不交互 记得加 -y
 
yum remove docker \
 
yum remove docker \
 
                   docker-client \
 
                   docker-client \
第35行: 第38行:
 
      
 
      
 
yum makecache fast
 
yum makecache fast
yum install docker-ce -y   
+
yum install docker-ce docker-ce-cli containerd.io #Sep 2021
 +
#yum install docker-ce -y   
 
systemctl enable docker
 
systemctl enable docker
 
systemctl start docker
 
systemctl start docker
第41行: 第45行:
 
#NOTE 不要用pip 安装 容易出事,见最下面的直接 curl  官方二进制包  
 
#NOTE 不要用pip 安装 容易出事,见最下面的直接 curl  官方二进制包  
 
yum -y install vim wget curl yum-utils bash-completion bash-completion-extras epel-release lrzsz telnet python-pip
 
yum -y install vim wget curl yum-utils bash-completion bash-completion-extras epel-release lrzsz telnet python-pip
pip install docker-compose
+
#pip install docker-compose
  
mkdir -p /home/data/docker
+
mkdir -p /home/data/dockerdata
  
echo '{"graph": "/home/data/docker"}' >/etc/docker/daemon.json
+
echo '{"graph": "/home/data/dockerdata"}' >/etc/docker/daemon.json
 
# cat /etc/docker/daemon.json  
 
# cat /etc/docker/daemon.json  
 
{"graph": "/home/data/docker"}
 
{"graph": "/home/data/docker"}
第55行: 第59行:
 
</pre>
 
</pre>
 
https://docs.docker.com/install/linux/docker-ce/centos/
 
https://docs.docker.com/install/linux/docker-ce/centos/
 +
 +
=ubuntu 20.04=
 +
<pre>
 +
#国内
 +
 +
sudo apt-get install ca-certificates curl gnupg lsb-release
 +
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 +
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 +
sudo apt-get update
 +
rm -rf /var/run/docker.sock/
 +
sudo apt-get install docker-ce docker-ce-cli containerd.io
 +
systemctl start docker
 +
systemctl status  docker
 +
 +
 +
#国外
 +
sudo apt-get update
 +
sudo apt-get install    ca-certificates    curl    gnupg    lsb-release
 +
sudo mkdir -m 0755 -p /etc/apt/keyrings
 +
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 +
echo  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
 +
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 +
cat /etc/apt/sources.list.d/docker.list
 +
sudo apt-get update
 +
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
 +
 +
 +
</pre>
 +
https://docs.docker.com/engine/install/ubuntu/
  
 
=on debian=
 
=on debian=
 
==国内网络==
 
==国内网络==
 
<pre>
 
<pre>
sudo apt-get update
+
最后参考一下下面的国外 是新的官方教程 2021
apt-get install -y gnupg2
+
 
 +
apt install sudo -y
 +
sudo apt update
 +
apt install -y gnupg2
 
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
 
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
 
# step 2: 安装GPG证书
 
# step 2: 安装GPG证书
 
+
#aliyun的有时不通
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo apt-key add -
+
# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo apt-key add -
 +
curl -fsSL  https://mirrors.163.com/docker-ce/linux/debian/gpg | sudo apt-key add -
 
# Step 3: 写入软件源信息
 
# Step 3: 写入软件源信息
 
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable"
 
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable"
 
# Step 4: 更新并安装Docker-CE
 
# Step 4: 更新并安装Docker-CE
sudo apt-get -y update
+
sudo apt -y update
sudo apt-get -y install docker-ce
+
sudo apt -y install docker-ce
  
 
  安装指定版本的Docker-CE:
 
  安装指定版本的Docker-CE:
第82行: 第119行:
 
<pre>
 
<pre>
  
 +
 +
Aug 17 2021
 +
 +
sudo apt-get install    apt-transport-https    ca-certificates    curl    gnupg    lsb-release
 +
 +
  curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 +
echo  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
 +
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 +
sudo apt update
 +
  sudo apt-get install docker-ce docker-ce-cli containerd.io
 +
 +
 +
sudo apt-get install docker-ce docker-ce-cli containerd.io
 +
 +
 +
如果是kali 2020
 +
cat /etc/apt/sources.list.d/docker.list
 +
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian  buster  stable
 +
#deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian  kali-rolling stable
 +
 +
 +
#old
 
#Fri Nov  8 09:54:03 CST 2019
 
#Fri Nov  8 09:54:03 CST 2019
apt  install software-properties-common  -y
+
#apt  install software-properties-common  -y
  
 
apt-get remove docker docker-engine docker.io containerd runc
 
apt-get remove docker docker-engine docker.io containerd runc
  
sudo apt-get install -y \
+
apt-get install -y \
 
     apt-transport-https \
 
     apt-transport-https \
 
     ca-certificates \
 
     ca-certificates \
第103行: 第162行:
 
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
 
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
 
</pre>
 
</pre>
 +
https://docs.docker.com/engine/install/debian/
 +
 +
https://www.kali.org/docs/containers/installing-docker-on-kali/
 +
 
https://docs.docker.com/install/linux/docker-ce/debian/
 
https://docs.docker.com/install/linux/docker-ce/debian/
  
=[[DockerHub镜像加速]]=
+
= 修改docker数据目录 修改docker的默认存储位置=
 +
Note ubuntu18.04 确实是跟楼主一样 要用data-root,而不是graph
 +
 
 +
<pre>
 +
 
 +
#2020 centos and debian
 +
mkdir -p /data/docker
 +
 
 +
echo '{"graph": "/data/docker"}' >/etc/docker/daemon.json
 +
# cat /etc/docker/daemon.json
 +
#{"graph": "/data/docker"}
 +
 
 +
systemctl restart docker
 +
 
 +
#验证docker储存位置
 +
docker system info | grep "Root Dir"
 +
</pre>
 +
 
 +
[https://blog.csdn.net/BigData_Mining/article/details/104921479  三种方法修改docker的默认存储位置]
 +
 
 +
[https://www.cnblogs.com/hellxz/p/docker-change-data-root.html 修改Docker数据目录位置,包含镜像位置]
 +
 
 +
https://www.cnblogs.com/davygeek/p/9940022.html
 +
==修改docker的默认存储位置 及数据迁移==
 +
<pre>
 +
mkdir -p  /data/docker_root
 +
 
 +
docker info | grep "Docker Root Dir"
 +
WARNING: IPv4 forwarding is disabled
 +
WARNING: bridge-nf-call-iptables is disabled
 +
WARNING: bridge-nf-call-ip6tables is disabled
 +
Docker Root Dir: /var/lib/docker
 +
 
 +
#2020 centos and debian
 +
mkdir -p /data/dockerrootdir
 +
#这个格式可能有错了 在kali docker 27
 +
echo '{"graph": "/data/dockerrootdir"}' >/etc/docker/daemon.json
 +
# cat /etc/docker/daemon.json
 +
#{"graph": "/data/docker"}
 +
 
 +
或者这种数据格式  这种格式最好了 sep 2024
 +
cat /etc/docker/daemon.json
 +
{
 +
"data-root": "/data/docker_root",
 +
"live-restore": true,
 +
"log-driver": "json-file",
 +
"log-opts": {
 +
  "max-file": "3",
 +
  "max-size": "10m"
 +
},
 +
"registry-mirrors": [
 +
  "https://hub-mirror.c.163.com",
 +
  "http://f1361db2.m.daocloud.io"
 +
]
 +
}
 +
 
 +
 
 +
systemctl restart docker
 +
 
 +
#验证docker储存位置
 +
docker system info | grep "Root Dir"
 +
 
 +
#数据迁移
 +
 
 +
systemctl  stop    docker
 +
 
 +
mkdir -p  /data/docker_root
 +
cd /data/docker_root
 +
cp -a /var/lib/docker/*  .
 +
 
 +
systemctl  start    docker
 +
 
 +
迁移好再启动 docker ps 东西还在 完美迁移完成
 +
 
 +
</pre>
 +
 
 +
=[[DockerHub镜像加速和代理]]=
  
 
=docker-compose=
 
=docker-compose=
第113行: 第252行:
 
#如果在内网看下面的手工 或者找个国内的 镜像吧  
 
#如果在内网看下面的手工 或者找个国内的 镜像吧  
  
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 
  
sudo chmod +x /usr/local/bin/docker-compose
 
  
curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64"  -o /usr/bin/docker-compose
+
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64"  -o /usr/bin/docker-compose
 +
sudo chmod +x /usr/bin/docker-compose
 +
 
 +
 
 +
#官方教程 但是可能找不到
 +
sudo curl -L "https://github.com/docker/compose/releases/download/2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 +
 
 
sudo chmod +x /usr/local/bin/docker-compose
 
sudo chmod +x /usr/local/bin/docker-compose
  
#官方教程  有些机器 path没这个目录   
+
#官方教程  有些机器 path没这个目录  特别是centos7.9
 
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  
第129行: 第272行:
 
==国内 和手工 ==
 
==国内 和手工 ==
 
<pre>
 
<pre>
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/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
 
#curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
 
chmod +x /usr/local/bin/docker-compose
 
chmod +x /usr/local/bin/docker-compose
第140行: 第283行:
 
</pre>
 
</pre>
  
 +
=trouble shooting=
 +
==docker 升级后报错 ==
 +
https://www.kali.org/docs/containers/installing-docker-on-kali/
 +
 +
[https://www.cnblogs.com/allay/p/17465751.html 彻底解决start request repeated too quickly for docker.service,docker无法启动问题]
  
=trouble shooting=
+
查看log  原来 老的daemon.json 不行了
 +
oot@myxps:~# journalctl -u docker.service
 +
9月 26 14:33:47 myxps systemd[1]: Starting docker.service - Docker Application Container Engine...
 +
9月 26 14:33:47 myxps (dockerd)[2477]: docker.service: Referenced but unset environment variable evaluates to an empty string: DOCKER_OPTS
 +
9月 26 14:33:48 myxps dockerd[2477]: unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '{' after top-level value
 +
9月 26 14:33:48 myxps systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
 +
9月 26 14:33:48 myxps systemd[1]: docker.service: Failed with result 'exit-code'.
 +
9月 26 14:33:48 myxps systemd[1]: Failed to start docker.service - Docker Application Container Engine.
 +
9月 26 14:33:50 myxps systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.
 
==docker-compose up 启动容器服务超时错误:ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. ==  
 
==docker-compose up 启动容器服务超时错误:ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. ==  
 
<pre>
 
<pre>

2024年9月26日 (四) 07:23的最新版本

参考

Docker-compose教程

Docker 镜像瘦身优化


docker-compose安装所有常用服务

Docker国内镜像的配置及使用

最后改DNS8.8.4.4

docker on cenos7

#install docker  如果不交互 记得加 -y 
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

yum install -y yum-utils \
           device-mapper-persistent-data \
           lvm2
  
#如果在外网         
 yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
#如果在国内 这里不要用 ali dns  反而是在国内用 8.8.4.4速度正常 or 114.114.114.114
yum-config-manager \
    --add-repo \
    https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
    
yum makecache fast
 yum install docker-ce docker-ce-cli containerd.io #Sep 2021
#yum install docker-ce -y   
systemctl enable docker
systemctl start docker

#NOTE 不要用pip 安装 容易出事,见最下面的直接 curl  官方二进制包 
yum -y install vim wget curl yum-utils bash-completion bash-completion-extras epel-release lrzsz telnet python-pip
#pip install docker-compose

mkdir -p /home/data/dockerdata

echo '{"graph": "/home/data/dockerdata"}' >/etc/docker/daemon.json
# cat /etc/docker/daemon.json 
{"graph": "/home/data/docker"}

systemctl restart docker

#验证docker储存位置
docker system info | grep "Root Dir"

https://docs.docker.com/install/linux/docker-ce/centos/

ubuntu 20.04

#国内

sudo apt-get install ca-certificates curl gnupg lsb-release
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
rm -rf /var/run/docker.sock/
 sudo apt-get install docker-ce docker-ce-cli containerd.io
 systemctl start docker 
systemctl status  docker


#国外
 sudo apt-get update
 sudo apt-get install     ca-certificates     curl     gnupg     lsb-release
 sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 cat /etc/apt/sources.list.d/docker.list 
sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin


https://docs.docker.com/engine/install/ubuntu/

on debian

国内网络

最后参考一下下面的国外 是新的官方教程 2021

apt install sudo -y 
sudo apt update
apt install -y gnupg2
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
#aliyun的有时不通 
# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo apt-key add -
curl -fsSL   https://mirrors.163.com/docker-ce/linux/debian/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE
sudo apt  -y update
sudo apt -y install docker-ce

 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# apt-cache madison docker-ce

 Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)
# sudo apt-get -y install docker-ce=[VERSION]

国外网络



Aug 17 2021 

sudo apt-get install     apt-transport-https     ca-certificates     curl     gnupg     lsb-release

  curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 echo   "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update 
  sudo apt-get install docker-ce docker-ce-cli containerd.io


sudo apt-get install docker-ce docker-ce-cli containerd.io


如果是kali 2020 
cat /etc/apt/sources.list.d/docker.list 
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian   buster  stable
#deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian   kali-rolling stable


#old
#Fri Nov  8 09:54:03 CST 2019
#apt  install software-properties-common  -y

apt-get remove docker docker-engine docker.io containerd runc

apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg2 \
    software-properties-common

 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

 sudo apt-key fingerprint 0EBFCD88
 sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
 apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

https://docs.docker.com/engine/install/debian/

https://www.kali.org/docs/containers/installing-docker-on-kali/

https://docs.docker.com/install/linux/docker-ce/debian/

修改docker数据目录 修改docker的默认存储位置

Note ubuntu18.04 确实是跟楼主一样 要用data-root,而不是graph


#2020 centos and debian
mkdir -p /data/docker

echo '{"graph": "/data/docker"}' >/etc/docker/daemon.json
# cat /etc/docker/daemon.json 
#{"graph": "/data/docker"}

systemctl restart docker

#验证docker储存位置
docker system info | grep "Root Dir"

三种方法修改docker的默认存储位置

修改Docker数据目录位置,包含镜像位置

https://www.cnblogs.com/davygeek/p/9940022.html

修改docker的默认存储位置 及数据迁移

 mkdir -p  /data/docker_root

docker info | grep "Docker Root Dir"
WARNING: IPv4 forwarding is disabled
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Docker Root Dir: /var/lib/docker

#2020 centos and debian 
mkdir -p /data/dockerrootdir
#这个格式可能有错了 在kali docker 27 
echo '{"graph": "/data/dockerrootdir"}' >/etc/docker/daemon.json
# cat /etc/docker/daemon.json 
#{"graph": "/data/docker"}

或者这种数据格式  这种格式最好了 sep 2024
 cat /etc/docker/daemon.json
{
 "data-root": "/data/docker_root", 
 "live-restore": true, 
 "log-driver": "json-file", 
 "log-opts": {
  "max-file": "3", 
  "max-size": "10m"
 }, 
 "registry-mirrors": [
  "https://hub-mirror.c.163.com", 
  "http://f1361db2.m.daocloud.io"
 ]
}


systemctl restart docker

#验证docker储存位置
docker system info | grep "Root Dir"

#数据迁移 

systemctl   stop    docker

mkdir -p  /data/docker_root
cd /data/docker_root
cp -a /var/lib/docker/*   .

systemctl   start     docker

迁移好再启动 docker ps 东西还在 完美迁移完成 

DockerHub镜像加速和代理

docker-compose

国外


#如果在内网看下面的手工 或者找个国内的 镜像吧 



sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64"  -o /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose


#官方教程 但是可能找不到
sudo curl -L "https://github.com/docker/compose/releases/download/2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

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

#官方教程  有些机器 path没这个目录  特别是centos7.9
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 docker-compose 

国内 和手工

curl -L "https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/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
chmod +x /usr/local/bin/docker-compose

#firefox 直接下载居然很快 
wget https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64

curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64“

trouble shooting

docker 升级后报错

https://www.kali.org/docs/containers/installing-docker-on-kali/

彻底解决start request repeated too quickly for docker.service,docker无法启动问题

查看log 原来 老的daemon.json 不行了 oot@myxps:~# journalctl -u docker.service 9月 26 14:33:47 myxps systemd[1]: Starting docker.service - Docker Application Container Engine... 9月 26 14:33:47 myxps (dockerd)[2477]: docker.service: Referenced but unset environment variable evaluates to an empty string: DOCKER_OPTS 9月 26 14:33:48 myxps dockerd[2477]: unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '{' after top-level value 9月 26 14:33:48 myxps systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE 9月 26 14:33:48 myxps systemd[1]: docker.service: Failed with result 'exit-code'. 9月 26 14:33:48 myxps systemd[1]: Failed to start docker.service - Docker Application Container Engine. 9月 26 14:33:50 myxps systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.

docker-compose up 启动容器服务超时错误:ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.

docker-compose up 启动容器服务超时错误:ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.


由于docker-compose up 同时启动的服务过多,超过了请求HTTP限制的60s时间仍未全部成功启动起来,所以出现了超时错误:

    ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
               If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

其中60s是默认的时间。
解决思路:

把 COMPOSE_HTTP_TIMEOUT 的值调大,并转为环境变量即可。

解决步骤:

先进入/etc/profile配置文件,执行命令:

    vi /etc/profile

然后在尾部添加上下面代码:

    export COMPOSE_HTTP_TIMEOUT=500
    export DOCKER_CLIENT_TIMEOUT=500

接着使/etc/profile配置文件生效,执行命令:

    source /etc/profile

最后重新执行命令 docker-compose up 即可。

删除volume 后报错 改一下 目录就好了 
ERROR: stat /var/lib/docker/overlay2/bc5838430495b942c06a838d8bfecaf416211fa98cc2e3a2372a33ebb7d3061e: no such file or directory


echo '{"graph": "/home/data/docker"}' >/etc/docker/daemon.json

Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io

Unable to find image 'telegrammessenger/proxy:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:58699->[::1]:53: read: connection refused.


restart docker 

ERROR: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

原来是他们没开外网 坑
oot@dev-fincy-mq03:/data/apps/redis-cluster# docker-compose up  -d 
Pulling redis-cluster-7004 (redis:5.0.4-alpine)...
ERROR: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

https://docs.docker.com/compose/install/

Docker快速安装以及换镜像源