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

来自linux中国网wiki
跳到导航 跳到搜索
第71行: 第71行:
 
   stable"
 
   stable"
 
  apt-get update
 
  apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
 
</pre>
 
</pre>
  

2020年4月15日 (三) 02:37的版本

最后改DNS8.8.4.4

docker on cenos7

#install docker
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
#如果在国内
yum-config-manager \
    --add-repo \
    https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
    
yum makecache fast
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/docker

echo '{"graph": "/home/data/docker"}' >/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/

on debian

国外网络


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

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

sudo 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

国内网络

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书

curl -fsSL https://mirrors.aliyun.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-get -y update
sudo apt-get -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]

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

DockerHub镜像加速

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 chmod +x /usr/local/bin/docker-compose

#官方教程  有些机器 path没这个目录  
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.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.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“

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

Docker快速安装以及换镜像源