# docker
首先安装依赖
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
添加信任Docker 的 GPG 公钥:(可以手动先下载下来在添加)
curl -fsSL https://download.docker.com/linux/debian/gpg |apt-key add -
添加软件仓库
add-apt-repository \
"deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release -cs) \
stable"
如果没有add-apt-repository命令的话可以先下载
apt-get install python-software-properties software-properties-common apt-transport-https
apt-get update
下载docker
apt-get update
apt-get install docker-ce
server start docker
docker -v
下载镜像慢的话可以镜像加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ig2l319y.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
docker-compose安装
下载最新版的docker-compose文件
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
添加可执行权限
chmod +x /usr/local/bin/docker-compose
测试安装结果
docker-compose --version
docker-compose version 1.16.1, build 1719ceb