微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS 7 上安装 Docker

from:

http://www.linuxidc.com/Linux/2014-12/110034.htm

Docker 软件包已经包括认的 CentOS-Extras 软件源里。因此想要安装 docker,只需要运行下面的 yum 命令:

[root@localhost ~]# yum install docker

安装完成后,使用下面的命令来启动 docker 服务,并将其设置为开机启动:

[root@localhost ~]# service docker start
[root@localhost ~]# chkconfig docker on

下载官方的 CentOS 镜像到本地

[root@localhost ~]# docker pull centos

确认 CentOS 镜像已经被获取

[root@localhost ~]# docker images centos

运行一个 Docker 容器:

[root@localhost ~]# docker run -i -t centos /bin/bash

[root@dbf66395436d /]#

我们可以看到,CentOS 容器已经被启动,并且我们得到了 bash 提示符。在 docker 命令中我们使用了 “-i 捕获标准输入输出”和 “-t 分配一个终端或控制台”选项。若要断开与容器的连接,输入 exit。

[root@cd05639b3f5c /]# cat /etc/RedHat-release CentOSLinux release 7.0.1406(Core) [root@cd05639b3f5c /]#exit exit [root@localhost ~]#

原文地址:https://www.jb51.cc/centos/376791.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。