Ubuntu 安装 Docker, Compose, Machine, Swarm

安装 Docker

有很多安装方式, 我喜欢一键脚本:

1
2
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

参考官方文档:

Docker: https://docs.docker.com/install/linux/docker-ce/ubuntu/

安装 Compose

下载编译好的包即可

1
2
3
4
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 或者
wget "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)"
mv docker-compose-$(uname -s)-$(uname -m) /usr/local/bin/docker-compose

如果对应的权限, 所有权不对的话, 更改之为

1
2
sudo chown root:root /usr/local/bin/docker-compose
sudo chmod 755 /usr/local/bin/docker-compose

参考官方文档:

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

安装 Machine

1
2
3
4
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine

参考官方文档:

Docker Machine: https://docs.docker.com/machine/install-machine/

安装 Swarm

Docker 1.12+ 已经内部集成了 Swarm.

如果是 1.12- 版本, 可以参考 Swarm 独立运行版 进行安装.

Donate - Support to make this site better.
捐助 - 支持我让我做得更好.