Docker 软件包已经包括在默认的 CentOS-Extras 软件源里 。因此想要安装 docker,只需要运行下面的 yum 命令:
[root@localhost ~]# yum install docker启动 Docker 服务
安装完成后,使用下面的命令来启动 docker 服务,并将其设置为开机启动:
[root@localhost ~]# service docker start[root@localhost ~]# chkconfig docker on(LCTT 译注:此处采用了旧式的 sysv 语法,如采用CentOS 7中支持的新式 systemd 语法,如下:
[root@localhost ~]# systemctl start docker.service[root@localhost ~]# systemctl enable docker.service)
下载官方的 CentOS 镜像到本地
[root@localhost ~]# docker pull centosPulling repository centos192178b11d36: Download complete70441cac1ed5: Download completeae0c2d0bdc10: Download complete511136ea3c5a: Download complete5b12ef8fd570: Download complete确认 CentOS 镜像已经被获取:
[root@localhost ~]# docker images centosREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcentos centos5 192178b11d36 2 weeks ago 466.9 MBcentos centos6 70441cac1ed5 2 weeks ago 215.8 MBcentos centos7 ae0c2d0bdc10 2 weeks ago 224 MBcentos latest ae0c2d0bdc10 2 weeks ago 224 MB运行一个 Docker 容器:
[root@localhost ~]# docker run -i -t centos /bin/bash[root@dbf66395436d /]#我们可以看到,CentOS 容器已经被启动,并且我们得到了 bash 提示符 。在 docker 命令中我们使用了 “-i 捕获标准输入输出”和 “-t 分配一个终端或控制台”选项 。若要断开与容器的连接,输入 exit 。
[root@cd05639b3f5c /]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [root@cd05639b3f5c /]# exitexit[root@localhost ~]#我们还可以搜索基于 Fedora 和 Ubuntu 操作系统的容器 。
[root@localhost ~]# docker search ubuntu[root@localhost ~]# docker search fedora【linux中docker的安装教程】到此这篇关于linux中docker的安装的文章就介绍到这了,更多相关linux docker安装内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!
- 春季老年人吃什么养肝?土豆、米饭换着吃
- 三八妇女节节日祝福分享 三八妇女节节日语录
- 老人谨慎!选好你的“第三只脚”
- 校方进行了深刻的反思 青岛一大学生坠亡校方整改校规
- 脸皮厚的人长寿!有这特征的老人最长寿
- 长寿秘诀:记住这10大妙招 100%增寿
- 春季老年人心血管病高发 3条保命要诀
- 眼睛花不花要看四十八 老年人怎样延缓老花眼
- 香槟然能防治老年痴呆症? 一天三杯它人到90不痴呆
- 老人手抖的原因 为什么老人手会抖
