Ubuntu 16.04下docker ce的安装
2018-01-05 11:08
573 查看
卸载版本的docker
sudo apt-get remove docker docker-engine docker.io
安装可选内核模块
从 Ubuntu 14.04 开始,一部分内核模块移到了可选内核模块包 ( linux-image-extra-* ) ,以
减少内核软件包的体积。正常安装的系统应该会包含可选内核模块包,而一些裁剪后的系统
可能会将其精简掉。 AUFS 内核驱动属于可选内核模块的一部分,作为推荐的 Docker 存储层
驱动,一般建议安装可选内核模块包以使用 AUFS 。如果没有安装的话可以使用下面的命令安装
sudo apt-get update sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
安装Docker CE
由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用
HTTPS 传输的软件包以及 CA 证书。
sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # 官方源 #curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
然后,我们需要向 source.list 中添加 Docker 软件源
sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable" # 官方源 # sudo add-apt-repository \ # "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ # $(lsb_release -cs) \ # stable
更新 apt 软件包缓存,并安装 docker-ce
sudo apt-get update sudo apt-get install docker-ce
启动docker CE
sudo systemctl enable docker sudo systemctl start docker
测试安装是否正确
sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world ca4f61b1923c: Pull complete Digest: sha256:445b2fe9afea8b4aa0b2f27fe49dd6ad130dfe7a8fd0832be5de99625dad47cd Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
如果出现上述信息,说明安装成功
镜像加速
由于国外的镜像有时候网络访问过慢,需要使用国内的镜像加速
对于使用 systemd 的系统,请在 /etc/docker/daemon.json 中写入如下内容(如果文件不存
在请新建该文件)
{ "registry-mirrors": [ "https://registry.docker-cn.com" ] }
之后重启启动系统
sudo systemctl daemon-reload sudo systemctl restart docker
相关文章推荐
- ubuntu 安装docker-ce及docker-compose
- 在Ubuntu 16.04环境下安装Docker-CE(附视频教程)
- ubuntu16.10安装docker17.03.0-ce并配置
- Ubuntu 16.04安装CUDA9+Docker CE+NVIDIA-Docker+TensorFlow/XGBoost
- 【Linux】【Docker】Ubuntu14.04 安装 Docker CE
- ubuntu安装docker-ce
- 阿里云ECS服务器Ubuntu下安装docker-ce技巧
- 人工智能利器:Docker-CE Ubuntu安装教程
- Ubuntu16.04下Docker、Docker-compose、Harbor的安装
- ubuntu 16.04 安装docker-ce并配置加速器,让docker运行一个桌面系统
- Ubuntu16.04安装docker-ce(阿里源)
- ubuntu 1604安装docker-ce 记录
- Docker - 在Ubuntu16.04中安装Docker CE
- Ubuntu 17.04 x64 安装 Docker CE 初窥 Dockerfile 部署 Ngi
- Docker CE for Ubuntu安装笔记
- ubuntu17.10安装docker-ce的方法
- ubuntu16.10安装docker17.03.0-ce并配置国内源和加速器
- Ubuntu 16.04安装CUDA9+Docker CE+NVIDIA-Docker+TensorFlow/XGBoost
- 在Ubuntu16.04中安装Docker Ce
- 在Ubuntu安装docker CE