win10环境下vmware中安装centos7并安装docker
一、安装vmware
二、下载并安装centos7镜像
CentOS 7镜像下载
官网下载链接:http://isoredirect.centos.org/centos/7/isos/x86_64/
step1: 进入下载页,选择阿里云站点进行下载
Actual Country 国内资源 Nearby Countries 周边国家资源
阿里云站点:http://mirrors.aliyun.com/centos/7/isos/x86_64/
每个链接都包括了镜像文件的地址、类型及版本号等信息
选择当前国家资源区站点下载,获取资源速度比较快
step1: 进入阿里云站点,选择 CentOS-7-x86_64-DVD-1804.iso下载
各个版本的ISO镜像文件说明:
CentOS-7-x86_64-DVD-1708.iso 标准安装版(推荐)
CentOS-7-x86_64-Everything-1708.iso 完整版,集成所有软件(以用来补充系统的软件或者填充本地镜像)
CentOS-7-x86_64-LiveGNOME-1708.iso GNOME桌面版
CentOS-7-x86_64-LiveKDE-1708.iso KDE桌面版
CentOS-7-x86_64-Minimal-1708.iso 精简版,自带的软件最少
CentOS-7-x86_64-NetInstall-1708.iso 网络安装版(从网络安装或者救援系统)
三、安装centos7可参考:https://blog.csdn.net/alan_liuyue/article/details/100765520
四、centos7安装docker
1.官网中文安装参考手册
https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#prerequisites
2、yum安装gcc相关
1)CentOS7能上外网
2)安装gcc
[[email protected] ~]# yum -y install gcc
3)安装gcc-c++
[[email protected] ~]# yum -y install gcc-c++
4)验证gcc是否安装成功
[[email protected] ~]#gcc -v
出现gcc相关版本信息即为安装成功
3、如果之前安装过docker,卸载旧版本
[[email protected] ~]# yum remove docker \
> docker-client \
> docker-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine
出现如下图说明没安装过docker,不删除任何软件包
4、安装需要的软件包
[[email protected] ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
5、设置stable镜像仓库
[[email protected] ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6、更新yum软件包索引
[[email protected] ~]# yum makecache fast
7、安装DOCKER CE
[[email protected] ~]# yum -y install docker-ce
8、启动docker
[[email protected] ~]# systemctl start docker
9、测试
1)查看docker版本
[[email protected] ~]# docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77156
Built: Sat May 4 02:34:58 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:02:43 2019
OS/Arch: linux/amd64
Experimental: false
[[email protected] ~]#
2)运行 hello-world
[[email protected] ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
[[email protected]ocalhost ~]#
11、配置镜像加速
1)、获取阿里云镜像加速器参考:https://blog.csdn.net/li1325169021/article/details/90770119
[[email protected] ~]# mkdir -p /etc/docker
[[email protected] ~]# vim /etc/docker/daemon.json
如果提示:vim : commond not found 说明还没安装vim
yum -y install vim*
可以先安装vim再去执行vim /etc/docker/daemon.json命令
在文件中添加如下配置
{"registry-mirrors": ["http://hub-mirror.c.163.com"] }
#阿里云镜像加速添加完ESC ,:wq保存并退出
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl restart docker
2)、配置镜像加速后重启docker可能会报错,参考:https://blog.csdn.net/li1325169021/article/details/90782846
12、停止、卸载、删除
[[email protected] ~]# systemctl stop docker
[[email protected] ~]# yum -y remove docker-ce
[[email protected] ~]# rm -rf /var/lib/docker
上一篇: 求最大子数组之和的方法解析(2种可选)
下一篇: Centos7环境下安装mongodb
推荐阅读
-
win10环境下vmware中安装centos7并安装docker
-
[视频教程] 如何在docker环境下的纯净ubuntu系统中安装最新版nginx
-
win10环境下安装Docker的实现
-
VMware中linux环境下oracle安装图文教程(二)ORACLE 10.2.05版本的升级补丁安装
-
VMware中linux环境下oracle安装图文教程(一)
-
[视频教程] 如何在docker环境下的纯净ubuntu系统中安装最新版nginx
-
win7中VMware安装CentOs7搭建Linux环境教程
-
centos7下通过yum方式安装docker环境
-
VMware workstation16 中Centos7下MySQL8.0安装过程及Navicat远程连接
-
CentOS7中配置Docker的yum源并安装使用详解