当前位置:首页>开发>正文

yum 安装docker 如何在centos7上通过yum安装docker

2023-04-09 22:55:09 互联网 未知 开发

yum 安装docker 如何在centos7上通过yum安装docker

如何在centos7上通过yum安装docker

centos7的yum源,关于docker的包都比较老了
如果是国外的vps,用docker官方提供的安装脚本:
# curl -sSL https://get.docker.com | sh
国内的主机:
# curl -sSL https://get.daocloud.io/docker | sh
等脚本运行完成,docker就装好了

怎样在阿里云上安装docker

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

[root@localhost ~]# yum install docker

如何安装指定版本的docker

1、修改yum源,指定Docker官方的yum源;

2、使用 yum install docker-enginer 安装Docker,在安装过程中,很容易出现mirror下载速度太低,导致安装失败,只能多运行几次了。
3、安装成功后,需要启动docker的daemon服务。

docker 里可以安装docker吗

可以的,我们将讨论如何在 CentOS 7.x 中安装 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

此处采用了旧式的 sysv 语法,如采用CentOS 7中支持的新式 systemd 语法,如下:
[root@localhost ~]# systemctl start docker.service[root@localhost ~]# systemctl enable docker.service

如何在 CentOS 7 上安装 Docker

1、使yum的CentOS-Extras配置生效
文件CentOS-Base.repo中enabled的値从0变成vim /etc/yum.repos.d/CentOS-Base.repo
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1 ★ 値从0变成※Docker is included by default in the CentOS-Extras repository

2、执行yum 安装
# yum install docker

3、Docker启动
# systemctl start docker

更多详情请参考docker官方资料,
https://wiki.centos.org/Cloud/Docker
https://docs.docker.com/installation/centos/

如何安装docker toolbox

Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想要安装 docker,只需要运行下面的 yum 命令: [root@localhost ~]# yum install docker

最新文章