centos7安装docker

1.官网中文安装参考手册

https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#prerequisites

2、yum安装gcc相关

1)CentOS7能上外网

2)安装gcc

[root@localhost ~]# yum -y install gcc
3)安装gcc-c++

[root@localhost ~]# yum -y install gcc-c++

图像出现如下说明安装成功!!!

3、如果之前安装过docker,卸载旧版本

[root@localhost ~]# yum remove docker \
>                       docker-client \
>                       docker-client-latest \
>                       docker-common \
>                       docker-latest \
>                       docker-latest-logrotate \
>                       docker-logrotate \
>                       docker-engine
4、安装需要的软件包

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
5、设置stable镜像仓库

[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6、更新yum软件包索引

[root@localhost ~]# yum makecache fast
7、安装DOCKER CE

[root@localhost ~]# yum -y install docker-ce
8、启动docker

[root@localhost ~]# systemctl start docker
9、测试

1)查看docker版本

[root@localhost ~]# 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
[root@localhost ~]#

2)运行 hello-world
[root@localhost ~]# 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/

[root@localhost ~]#
11、配置镜像加速
1)、获取阿里云镜像加速器参考:https://blog.csdn.net/li1325169021/article/details/90770119

[root@localhost ~]#  mkdir -p /etc/docker
[root@localhost ~]# vim  /etc/docker/daemon.json
在文件中添加如下配置
#阿里云镜像加速器
#网易云

{"registry-mirrors": ["http://hub-mirror.c.163.com"] }

#阿里云

{

"registry-mirrors": ["https://{自已的编码}.mirror.aliyuncs.com"]

}

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
2)、配置镜像加速后重启docker可能会报错,参考:https://blog.csdn.net/li1325169021/article/details/90782846

12、卸载

[root@localhost ~]#  systemctl stop docker
[root@localhost ~]# yum -y remove docker-ce
[root@localhost ~]# rm -rf /var/lib/docker

(0)

相关推荐

  • 记录下在CentOS7中安装Docker CE

    记录下在CentOS7中安装Docker CE 1. 卸载系统中可能存在的老版本 在CentOS中,老版本Docker的软件包名是docker或docker-engine,而Docker CE的软件包 ...

  • CentOS 7 部署安装配置 Docker 17.06

    一.Docker的安装 Docker目前官方主要有两个版本,一个是企业版(docker-ee),一个是社区版(docker-ce),我们这里主要使用的是社区版. 1.安装Docker CE CentO ...

  • centos7上如何安装docker?详细操作教你搞定~

    现在越来越多的开发都是用到docker容器,那么要如何在centos上安装docker呢?下面就一步步介绍一下如何安装. docker 要求 CentOS 系统的内核版本高于 3.10,首先需要查看一 ...

  • (3条消息) Centos7下安装Docker(详细安装教程)

    一,Docker简介 百科说:Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙 ...

  • linux下(centos7)docker安装

    参考链接https://docs.docker.com/install/linux/docker-ce/centos/ 第一步,确定是centos7及以上版本 cat /etc/redhat-rele ...

  • docker安装配置

    ###########################################docker安装配置#环境centos7 #配置docker阿里源echo '#Docker[docker-ce- ...

  • Docker 深入浅出

    Docker 概述 Docker 为什么会出现 我们在学习 Docker 之前,可以先来思考一下 Docker 为什么会出现? 如果大家已经接触过编程,并且自己上线过项目.可能会遇到一个问题,就是自己 ...

  • 初识Docker

    时间 主题 7.23(周二)14:00 Selenium环境搭建与原理 7.24(周三)20:00 Docker使用 软件开发最大的麻烦事之一,就是环境配置.用户计算机的环境不相同,可能导致软件无法运 ...

  • CentOS Docker 基础

    CentOS Docker 基础

  • CentOS7安装docker和docker-compose

    CentOS7安装docker和docker-compose

  • 群晖NAS安装Docker容器版emby(zishuo版)

    原文链接 『原汁原味的官方Docker容器用法,只是单纯的进行破解及插件源,内置刮削补丁穿墙方案,改善大陆地区的用户体验,本镜像不用任何插件即可硬件转码和外网播放(小白不懂就多看看教程,不显示硬件转码 ...

  • CentOS/Ubuntu/Debian一键安装Docker教程

    本文目录 隐藏 1一.Docker安装脚本使用教程 2二.其他安装Docker教程 Docker现在越来越火,确实基于Docker安装很多程序也方便了不少,目前很多教程都是基于Docker搭建的,所以 ...

  • centos7安装rabbitmq3.7.9 | 易学教程

    感谢此兄: https://blog.51cto.com/huwei555/2341513?source=dra  (centos7 安装rabbitmq 3.7) 以root用户登录. cd /ho ...

  • centos7安装数据库MariaDB

    在CentOS7下,默认安装的数据库为MariaDB,属于MySQL数据库的一个分支,所以我还是使用了MariaDB: #yum install mariadb-server -y #systemct ...

  • 一键安装Docker容器以及常见的运行命令记录

    我们一般的站长安装源码都是常规的一键SHELL安装或者编译安装,但是如果我们学会Docker容器的话,会觉得很方便,但是在学习和使用Docker的时候还是有一些不同的工具需要知道的.毕竟Docker算 ...