vmware下的centos7系统安装docker

安装 docker

系统配置:vmware 12; centos 7。参考 docker 官方文档来操作安装:https://docs.docker.com/engine/install/centos/

[root@docker211 ~]# yum install -y yum-utils
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

虚机如何配置连接上网的步骤在另一篇文章中。

yum源为空,repolist = 0,查看下系统中yum的配置文件,是否有合适的资源地址。( 注:yum仓库就是使用yum命令下载软件的镜像地址。我们通常使用 yum install 命令来在线安装 linux系统的软件, 这种方式可以自动处理依赖性关系,并且一次安装所有依赖的软体包,但是经常会遇到从国外镜像下载速度慢,无法下载的情况。那么此时我们就需要把我们的yum 源改为国内的镜像。)

ls /etc/yum.repos.d

搜索国内yum仓库,主要有清华和阿里两个镜像仓库配置,但是我两个都配置过,还是各种的404连接错误。然后在查看官方文档后,使用了第二种安装方式,rpm包安装。

Installation methods
You can install Docker Engine in different ways, depending on your needs:

Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach. (第一种在线安装方式 Install using the repository)

Some users download the RPM package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.(第二种RPM包安装方式,需要先去官网下载相对应的版本文件 Install from a package)

In testing and development environments, some users choose to use automated convenience scripts to install Docker.(第三种未尝试)

下载地址:https://download.docker.com/linux/centos/ ,路径:7/x86_64/stable/Packages/ ,这里我选择的是稳定版的一个版本,docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm 。安装此 rpm 之前还需要下载另一个文件,docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm ,不然会有报错,提示错误信息如下:error信息展示

安装 docker engine,路径换成自己的路径:

sudo yum install /path/to/xxx-selinux-xxx.rpm
sudo yum install /path/to/docker-ce-xxx.rpm
sudo docker -v 

启动 docker:

sudo systemctl start docker

通过运行hello-world映像来验证Docker引擎是否正确安装:

sudo docker run hello-world

该命令下载一个测试映像并在容器中运行它。当容器运行时,它打印一条信息消息并退出。

终于可以愉快的玩耍 docker 了 !!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值