mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-13 00:11:22 +08:00
PUB:20141127 How to install Docker on CentOS 7
@felixonmars
This commit is contained in:
parent
aa3fca6507
commit
3f8ce06947
@ -1,5 +1,6 @@
|
||||
如何在 CentOS 7 上安装 Docker
|
||||
================================================================================
|
||||
|
||||
Docker 是一个开源工具,它可以让创建和管理 **Linux 容器**变得简单。容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止。Docker 帮助系统管理员和程序员在容器中开发应用程序,并且可以扩展到成千上万的节点。
|
||||
|
||||
容器和 VM(虚拟机)的主要区别是,容器提供了**基于进程的隔离**,而虚拟机提供了资源的完全隔离。虚拟机可能需要一分钟来启动,而容器只需要一秒钟或更短。容器使用宿主操作系统的内核,而虚拟机使用独立的内核。
|
||||
@ -20,8 +21,15 @@ Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想
|
||||
|
||||
[root@localhost ~]# service docker start
|
||||
[root@localhost ~]# chkconfig docker on
|
||||
|
||||
(LCTT 译注:此处采用了旧式的 sysv 语法,如采用CentOS 7中支持的新式 systemd 语法,如下:
|
||||
|
||||
**下载官方的 CentOS 镜像到本地**
|
||||
[root@localhost ~]# systemctl start docker.service
|
||||
[root@localhost ~]# systemctl enable docker.service
|
||||
|
||||
)
|
||||
|
||||
**下载官方的 CentOS 镜像到本地** (LCTT 译注:由于 Docker 被**墙** :-< ,所以请使用 http://docker.cn 的[镜像][1],感谢 @马全一 的镜像。 )
|
||||
|
||||
[root@localhost ~]# docker pull centos
|
||||
Pulling repository centos
|
||||
@ -45,7 +53,7 @@ Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想
|
||||
[root@localhost ~]# docker run -i -t centos /bin/bash
|
||||
[root@dbf66395436d /]#
|
||||
|
||||
我们可以看到,CentOS 容器已经被启动,并且我们得到了 bash 提示符。在 docker 命令中我们使用了 “-i attach 标准输入输出”和 “-t 分配一个终端或控制台”选项。若要断开与容器的连接,输入 exit。
|
||||
我们可以看到,CentOS 容器已经被启动,并且我们得到了 bash 提示符。在 docker 命令中我们使用了 “-i 捕获标准输入输出”和 “-t 分配一个终端或控制台”选项。若要断开与容器的连接,输入 exit。
|
||||
|
||||
[root@cd05639b3f5c /]# cat /etc/redhat-release
|
||||
CentOS Linux release 7.0.1406 (Core)
|
||||
@ -68,8 +76,9 @@ via: http://www.linuxtechi.com/install-docker-on-centos-7/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
译者:[felixonmars](https://github.com/felixonmars)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.linuxtechi.com/author/pradeep/
|
||||
[1]:https://docker.cn/h/how-to-use-docker-official-repositories
|
Loading…
Reference in New Issue
Block a user