《循序渐进学Docker》——3.3 在Ubuntu下安装Docker
2023-09-11 14:16:11 时间
本节书摘来自华章出版社《循序渐进学Docker》一书中的第3章,第3.3节,作者李金榜 尹烨 刘天斯 陈纯,更多章节内容可以访问云栖社区“华章计算机”公众号查看。
3.3 在Ubuntu下安装Docker通过GNU GRUB选择进入Ubuntu系统,配置好网络。
先通过下面命令更新一下apt软件源。
sudo apt-get update
安装Docker有两种方式。
方法一:从apt源安装docker.io,但版本比较旧。
sudo apt-get install docker.io
方法二:使用官方提供的安装脚本,可以安装最新版本的Docker,推荐使用这种安装方式,安装命令如下:
sudo apt-get install curl curl -sSL https://get.docker.com/ | sh
安装完成后,通过如下命令启动Docker的守护进程。
$ sudo service docker start docker start/running. process 3050
然后,可以通过如下脚本检查Docker安装是否成功。
$ sudo docker run hello-world Unable to f?ind image hello-world:latest locally latest: Pulling from library/hello-world 03f4658f8b78: Pull complete a3ed95caeb02: Pull complete Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 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. 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 Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/userguide/
如果不想每次运行Docker都使用sudo权限,可以把用户加到Docker组中。例如,我的用户名为harney,则添加命令如下:
$ sudo usermod -aG docker harney
重启后生效,再次执行Docker的指令,直接输入“docker ××”,不需要加“sudo”了。
现在在Ubuntu下的Docker已经安装成功了。
相关文章
- 【Ubuntu】通过虚拟机安装系统( ubuntu )
- 【Ubuntu】ubuntu物理机安装方法:U盘安装
- 【Ubuntu】Linux系统( ubuntu )安装方案
- ubuntu安装 docker-compose
- Ubuntu 安装Docker
- ubuntu16.04 安装cuda9.0+cudnn7.0.5+tensorflow+nvidia-docker配置GPU服务
- 【Docker异常】docker-compose up throw UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 97: ordinal not in range(128)
- 【Docker】docker安装mysql
- 【Docker】docker安装GitLab
- 【Docker】docker的安装和常用命令
- Docker - 在Ubuntu16.04中安装Docker CE
- Ubuntu安装Docker引擎和支持HTTPS的docker-registry服务
- ubuntu deepin等debian系Linux发行版安装docker-ce命令
- 【收藏】Docker安装微信
- Docker安装部署MongoDB及MySql和MongoDB的语法对比
- 阿里云上的docker安装
- 06-Ubuntu 20 安装docker
- docker 的安装
- 008-docker-安装-tomcat:8.5.38-jre8
- 81.第十七章 企业级容器技术docker -- Docker 数据管理、Docker网络管理(九)
- 【云原生之Docker实战】使用docker部署Pingvin Share文件共享平台
- Ubuntu20.04 在线安装docker
- 1-使用华为云的ubuntu系统安装docker Linux安装docker安装 国内安装有时候很慢 最好翻墙安装
- 【云原生 • Docker】docker 入门、docker 与虚拟机对比、docker 组件
- ubuntu 下 docker 安装 和 hadoop镜像 安装
- Ubuntu 14.04 16.04 安装最新的 docker
- Docker安装Jenkins
- 【服务器安装系列】CentOS7 安装及配置 Docker
- Ubuntu20.04二进制安装docker