CentOS 7 中 Docker 的安装
来源:互联网 发布:网络订票在代办点取票 编辑:程序博客网 时间:2024/04/29 22:41
CentOS 7 中 Docker 的安装
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 镜像到本地 (LCTT 译注:由于 Docker 被墙 :-< ,所以请使用http://docker.cn 的镜像,感谢 @马全一 的镜像。 )
- [root@localhost ~]# docker pull centos
- Pulling repository centos
- 192178b11d36: Download complete
- 70441cac1ed5: Download complete
- ae0c2d0bdc10: Download complete
- 511136ea3c5a: Download complete
- 5b12ef8fd570: Download complete
确认 CentOS 镜像已经被获取:
- [root@localhost ~]# docker images centos
- REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
- centos centos5 192178b11d36 2 weeks ago 466.9 MB
- centos centos6 70441cac1ed5 2 weeks ago 215.8 MB
- centos centos7 ae0c2d0bdc10 2 weeks ago 224 MB
- centos 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 /]# exit
- exit
- [root@localhost ~]#
我们还可以搜索基于 Fedora 和 Ubuntu 操作系统的容器。
- [root@localhost ~]# docker search ubuntu
- [root@localhost ~]# docker search fedora
显示当前正在运行容器的列表
0 0
- CentOS 7 中 Docker 的安装
- CentOS 7 中 Docker 的安装
- CentOS 7 中 Docker 的安装
- Docker 在CentOS 7中安装Docker
- 在CentOS 7中安装Docker
- centos 7安装docker
- Centos 7 安装 docker
- Centos 7安装Docker
- CentOS 7安装Docker
- centos 7 安装 Docker
- CentOS 7 安装docker
- CentOS-7安装Docker
- centos 7安装docker
- CentOS 7 安装 docker
- CentOS 7 安装 Docker
- Centos 6.4中安装Docker
- Centos 7安装docker的日志
- CentOS 6.9中安装Docker的一些问题
- Android三种播放视频的方式(全屏模式的切换)
- java中read()和readline()方法对比
- MVC系列之一:Servlet、Jsp的传值问题
- 深入浅出JMS(三)--ActiveMQ简单的HelloWorld实例
- 一维数组与指针
- CentOS 7 中 Docker 的安装
- SSL延迟有多大
- Ajax
- 安装openCV,测试时出现mvscr120d.dll文件丢失
- JavaEE-Hibernate入门笔记
- 绽放你的美丽-java20年
- Spring运行机制
- 在命令行环境Java程序调用导入的jar包中的类
- hibernate注解笔记