dockercentos7的简单介绍

本篇文章给大家谈谈dockercentos7,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

如何在Centos7上安装&使用docker

1、使yum的困纤闭CentOS-Extras配置生效

文件汪裂CentOS-Base.repo中enabled的値从0变成1

vim /etc/yum.repos.d/CentOS-Base.repo

[extras]

name=CentOS-$releasever - Extras

mirrorlist=;arch=$basearchrepo=extras

gpgcheck=1

gpgkey=

enabled=1 ★ 値从0变成1

※竖饥Docker is included by default in the CentOS-Extras repository

2、执行yum 安装

# yum install docker

3、Docker启动

# systemctl start docker

[img]

如何在CentOS 7上安装最新版本的Docker

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 镜像到本地

[root@localhost ~]# docker pull centosPulling repository centos192178b11d36: Download complete 70441cac1ed5: Download complete ae0c2d0bdc10: Download complete 511136ea3c5a: Download complete 5b12ef8fd570: 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

显示当前正在运行容器的列表

centos7镜像源没有docker

-ce,从基消官激锋派网安装

1. 下载docker-ce的rpm包

[]()

2. 安明贺装docker-ce

```shell

# 安装依赖

yum install -y yum-utils device-mapper-persistent-data lvm2

# 添加docker-ce源

yum-config-manager --add-repo

# 安装docker-ce

yum -y install docker-ce

# 启动docker

systemctl start docker

# 设置开机启动

systemctl enable docker

```

如何在 CentOS 7 上安装 Docker

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 镜像到本地

[root@localhost ~]# docker pull centosPulling repository centos192178b11d36: Download complete 70441cac1ed5: Download complete ae0c2d0bdc10: Download complete 511136ea3c5a: Download complete 5b12ef8fd570: 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

显示当前正在运行容器的列表

centos7怎么安装docker

安装docker

1、Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过 uname -r 命令查看你当前的内核版本

$ uname -r

2、使用 root 权限登录 Centos。确保 yum 包更新到最新。

$ sudo yum update

3、卸载旧版本(如果安装过旧版本的话)

$ sudo yum remove docker docker-common docker-selinux docker-engine

4、安装需要的软册并尺蔽纤件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

5、设置yum源

$ sudo yum-config-manager --add-repo

6、可以查看所有仓库中所有docker版本,并选择特定版本安装

$ yum list docker-ce --showduplicates | sort -r

7、安装docker

$ sudo yum install docker-ce #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0

$ sudo yum install FQPN州高 # 例如:sudo yum install docker-ce-17.12.0.ce

8、启动并加入开机启动 《Linux就该这么学》

$ sudo systemctl start docker

$ sudo systemctl enable docker

9、验证安装是否成功(有client和service两部分表示docker安装启动都成功了)

$ docker version

关于dockercentos7和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

标签列表