最简单的教程:在Ubuntu操作系统里安装Docker
Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。
今天这篇文章咱们就来将Docker安装到Ubuntu上。
1. 由于Ubuntu里apt官方库里的docker版本可能比较低,因此先用下面的命令行卸载旧版本(如果有的话)
sudo apt-get remove docker docker-engine docker-ce docker.io
2. 更新apt包索引:
sudo apt-get update
3. 执行下列命令行,使apt可以通过HTTPS协议去使用存储库:
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
4. 添加Docker官方提供的GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
什么是GPG密钥呢?大家可以从阮一峰老师的博客:GPG入门教程里获得答案:
1991年,程序员Phil Zimmermann为了避开政府监视,开发了加密软件PGP。这个软件非常好用,迅速流传开来,成了许多程序员的必备工具。但是,它是商业软件,不能自由使用。所以,自由软件基金会决定,开发一个PGP的替代品,取名为GnuPG。这就是GPG的由来。
上面的文字出自阮一峰老师的博客链接:http://www.ruanyifeng.com/blog/2013/07/gpg.html
5. 设置stable存储库:
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
最后再次更新apt包索引:
6. 安装最新版本的docker-ce:
sudo apt-get install -y docker-ce
安装完毕后,可以看到Docker服务已经从/lib/systemd/system/docker.service启动了,dockerd进程id为4921:
命令行ps -aux查看进程id为4921的进程路径:/usr/bin/dockerd -H fd://
使用命令sudo docker version可以查看安装docker的版本:
使用命令sudo docker run hello-world,能观察到从远程下载这个测试用的容器:Pulling from library/hello-world:
然后看到打印消息:Hello from Docker! 说明Docker安装成功。
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://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
要获取更多Jerry的原创技术文章,请关注公众号"汪子熙"或者扫描下面二维码:
相关文章
- Docker安装RabbitMQ教程「建议收藏」
- docker部署jenkins安装使用教程_docker封装python程序
- docker安装gauss
- docker安装MySQL主从复制 读写分离
- docker 安装MongoDB
- Linux安装Docker完整教程
- Docker安装MongoDB并使用Navicat连接
- ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon runn
- Docker容器实战三:安装部署
- Docker 离线安装_docker官方中文文档
- gitlab docker安装_crawl用法
- docker 启动失败:Failed to start Docker Application Container Engine
- 【图文安装教程】在docker中安装kibana
- istio-in-action - 01 安装 docker-k3s-istio 开发环境
- 【Docker】Linux安装Docker(极简版)
- 【Docker 系列】docker 学习十,Compose 编写规则及wp 实战
- docker安装filebrowser
- Docker安装crmeb商城教程
- 5分钟教你docker安装启动redis全教程(全新方式)
- docker-compose 安装详解程序员
- docker的安装与使用详解程序员
- 使用Docker安装Redis并配置成功(docker安装redis)
- 使用Docker安装Redis,一步到位!(docker安装redis)
- 在Ubuntu Trusty 14.04 (LTS) (64-bit)安装Docker
- docker用Docker构建Redis集群的步骤(redis集群使用)