环境准备

通过命令查看系统版本和内核版本等信息

[gmuser@--- ~]$ cat /etc/redhat-release
CentOS Linux release 7.2. (Core)
[gmuser@--- ~]$ uname -a
Linux --- 3.10.-327.18..el7.x86_64 # SMP Thu May :: UTC x86_64 x86_64 x86_64 GNU/Linux
[gmuser@--- ~]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID=""
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION=""
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION=""

为用户提权(sudo)

[gmuser@--- ~]$ sudo install
[sudo] password for gmuser:
Sorry, try again. [sudo] password for gmuser:
gmuser is not in the sudoers file. This incident will be reported.
[gmuser@--- ~]$ su root Password:
[root@--- gmuser]# vim /etc/sudoers ## Allow root to run any commands anywhere root ALL=(ALL) ALL gmuser ALL=(ALL) ALL ## Allows members of the 'sys' group to run networking, software, ## service management apps and more. # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS ## Allows people in group wheel to run all commands

保存退出

操作系统需求

为兼容企业级应用,学习选用Centos7做为部署安装Docker的系统平台

 

更换默认的yum源

Centos默认的yun源在国外,速度很慢有时间也无法访问

[gmuser@--- ~]$ yum repolist

[gmuser@--- ~]$ vi /etc/hosts  

[gmuser@--- ~]$ ping mirrors.aliyun.com

更换成aliyun yum 源

[root@--- /]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

[root@--- /]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@--- /]# vi /etc/yum.repos.d/CentOS-Base.repo

Yum运行下面的命令生成缓存

[root@--- /]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@--- /]# yum makecache
[root@--- /]# yum repolist

删除docker旧版本

[gmuser@--- /]$ sudo yum remove docker docker-common docker-selinux docker-engine
[sudo] password for gmuser:
Loaded plugins: fastestmirror, langpacks
No Match for argument: docker
No Match for argument: docker-common
No Match for argument: docker-selinux
No Match for argument: docker-engine
No Packages marked for removal

安装 Docker CE

[gmuser@--- /]$ sudo yum remove docker docker-common docker-selinux docker-engine
[gmuser@--- /]$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[gmuser@--- /]$ sudo yum install -y docker-ce

若需要安装指定的版本时,可参照以下命令

启动docker

[gmuser@--- /]$ sudo systemctl start docker
[gmuser@--- /]$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [gmuser@--- /]$

升级和卸载docker

使用阿里镜像加速器

使用阿里云专属加速器加快获取Docker官方镜像,否则在国内速度会慢到你无法忍受哒。步骤如下:

  1. 免费注册一个阿里云账号 www.aliyun.com
  2. 进入加速器页面 https://cr.console.aliyun.com/#/accelerator
  3. 选择镜像加速器

按图中进行相关配置

 

参考文档:

Docker的部署安装(CentOS)-by paymob的更多相关文章

  1. Docker的部署安装(CentOS)

    环境准备 操作系统需求 为兼容企业级应用,学习选用Centos7做为部署安装Docker的系统平台 # 通过以下命令可查看系统版本和内核版本等信息 cat /etc/redhat-release #- ...

  2. Devops实战(一)Docker的部署安装以及Docker-Compose的使用

    Docker的部署安装以及Docker-Compose的使用 1.docker和docker-Compose简介 Docker是一组平台即服务(PaaS)产品,它们使用操作系统级虚拟化以称为容器的软件 ...

  3. docker运行环境安装-centos(一)

    在这里我们使用的是docker的社区版Docker CE,针对的是未安装docker的新的主机,如果安装过docker的早期版本,先卸载它们及关联的依赖资源,安装的版本为docker 18.03. 1 ...

  4. (二)docker的部署安装,配置,基础命令

    一.docker 的安装部署 这里不过多介绍,下面这两个linux发型版 安装可以参考 ubuntu的 docker-ce安装 centos7的 docker-ce安装 二.docker配置文件 重要 ...

  5. docker之windows安装&centOS安装

    按这个安装  没什么毛病 https://blog.csdn.net/vitaair/article/details/80894890 https://www.runoob.com/docker/ce ...

  6. 【Docker学习之二】Docker部署安装

    环境 docker-ce-19.03.1-3.el7.x86_64 一.Docker的部署安装 Docker采用Linux(内核)技术,所以只能运行在Linux上,官方说Linux kernel至少3 ...

  7. Docker学习笔记_04 Rancher的部署安装(编排选用K8S)

    原文地址:http://dbase.cc/2018/01/12/docker/04_rancher的部署安装/ 为什么要使用Rancher Rancher是一个开源的企业级容器管理平台.通过Ranch ...

  8. Rancher的部署安装(编排选用K8S)

    为什么要使用Rancher Rancher是一个开源的企业级容器管理平台.通过Rancher,企业再也不必自己使用一系列的开源软件去从头搭建容器服务平台.Rancher提供了在生产环境中使用的管理Do ...

  9. 【docker部署】基于linux的centos操作系统部署安装docker容器

    一.docker介绍 容器是轻量级的,包含应用运行所需所有东西(代码.库.运行时环境.系统设置,以及依赖关系)的独立的包.每个容器都部署于它自己的 CPU.内存.块 I/O,以及网络资源上,所有这些都 ...

随机推荐

  1. vue整合外部js

    vue引入外部jsimport { TrackLine } from "../../../../../static/js/trajectory.js";import { initM ...

  2. 移植zlib

    平台说明 开发平台:Ubuntu12.04 编 译器:arm-linux-gcc version 4.4.4 (4.4.4_09.06.2010) Zlib源码包:zlib-1.2.11.tar.gz ...

  3. 深入分析Java反射(六)-反射调用异常处理

    前提 Java反射的API在JavaSE1.7的时候已经基本完善,但是本文编写的时候使用的是Oracle JDK11,因为JDK11对于sun包下的源码也上传了,可以直接通过IDE查看对应的源码和进行 ...

  4. 微信支付的Demo

    是在一个子项目完成的, 依赖: <dependencies> <!-- spring-boot--> <dependency> <groupId>org ...

  5. strpos用法

    语法 strpos(string,find,start) 参数 描述 string 必需.规定要搜索的字符串. find 必需.规定要查找的字符串. start 可选.规定在何处开始搜索.   技术细 ...

  6. spring中的Filter使用

    https://blog.csdn.net/bibiwannbe/article/details/81302920

  7. @Component, @Repository, @Service,@Controller的区别

    @Component, @Service, @Controller, @Repository是spring注解,注解后可以被spring框架所扫描并注入到spring容器来进行管理 @Componen ...

  8. C语言笔记 16_标准库&stdio&stdlib&string&time

    <stdio.h> 简介 stdio .h 头文件定义了三个变量类型.一些宏和各种函数来执行输入和输出. 库变量 下面是头文件 stdio.h 中定义的变量类型: 序号 变量 & ...

  9. org.springframework.web.util.UriComponentsBuilder

    import org.springframework.web.util.UriComponentsBuilder; UriComponentsBuilder.fromHttpUrl("htt ...

  10. Spring boot 基于注解方式配置datasource

    Spring boot 基于注解方式配置datasource 编辑 ​ Xml配置 我们先来回顾下,使用xml配置数据源. 步骤: 先加载数据库相关配置文件; 配置数据源; 配置sqlSessionF ...