Docker安装
一、卸载旧版本
$ sudo apt-get remove docker docker-engine docker.io
二、安装Docker CE(社区版)
1.更新apt包
$ sudo apt-get update
2.安装依赖库
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
3.添加官方GPG key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.添加仓库
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
5. 安装docker
$ sudo apt-get update
$ sudo apt-get install docker-ce
三、验证安装是否成功
$ sudo docker run hello-world
四、Docker卸载
1.卸载docker-ce
$ sudo apt-get purge docker-ce
2.移除docker配置文件与镜像等
$ sudo rm -rf /var/lib/docker
五、以非root权限用户启动
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
然后就可以不用root启动了
$ docker run hello-world
六、查看Docker版本信息
$ docker --version
Docker version 17.12.0-ce, build c97c6d6
Run docker info or (docker version without --) to view even more details about your docker installation:
$ docker info # 或者docker version
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.0-ce
Storage Driver: overlay2
...