在centos上安装docker
原文:https://docs.docker.com/install/linux/docker-ce/centos/
https://docs.docker.com/compose/install/
1. 确保机器上没有旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2. 安装docker的repo
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3. 安装docker CE
yum install docker-ce
4. 添加启动项
systemctl enable docker
启动
systemctl start docker
4. 加一个非root用户
groupadd docker
usermod -aG docker $USER
添加好了要重新登录一下系统
5. 测一下
用新用户登录,跑一下hello world看看
docker run hello-world
6. 装docker compose
到github上看看最新的版本
https://github.com/docker/compose/releases
下载,加权限,测试
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version