Ubuntu 16.04 安装 Docker 以及 Docker Compose

@bingoogolapple 2017-01-22 02:22:40发表于 bingoogolapple/bingoogolapple.github.io Docker

通过 Docker 官方维护的脚本文件来安装 Docker「里面没有包含 docker-compose」

sudo apt-get update

curl -fsSL https://get.docker.com/ | sh

sudo usermod -aG docker $(whoami)

Ubuntu 16.04 安装 Docker「里面没有包含 docker-compose」

Ubuntu 16.04 官方的仓库中的 Docker 可能不是最新的,需要从 Docker 官方仓库中安装

sudo apt-get update

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'

sudo apt-get update

apt-cache policy docker-engine

sudo apt-get install -y docker-engine

sudo systemctl status docker

sudo usermod -aG docker $(whoami)

Ubuntu 16.04 安装 Docker Compose

安装

sudo -i

curl -L https://github.com/docker/compose/releases/download/1.10.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

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

Command-line completion

mkdir -p ~/.zsh/completion

curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose

vim ~/.zshrc
# 添加到 .zshrc 中
fpath=(~/.zsh/completion $fpath)

autoload -Uz compinit && compinit -i

exec $SHELL -l