在CentOS 7上安装Docker环境

时间:2022-10-25 23:14:11

官网文档:https://docs.docker.com/engine/installation/linux/centos/ ,本文大部分是照搬官方文档写的,如果你英文还不错,那么就直接移步官方文档吧,如果你英文实在是不行,那就勉强看一下本人这生涩的翻译~

以下操作均在root用户下完成

1.配置yum软件库

为保证安装的成功,首先使用yum update更新Yum包,表示我的好多yum包都需要更新,1500+的包,如果你像我一样好久没有更新过,那就耐心等候吧。

然后在yum软件库中新增docker的配置:

#  tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=
gpgcheck=
gpgkey=https://yum.dockerproject.org/gpg
EOF

2.安装Docker

有了yum软件库的配置之后,安装也变得异常的简单,只需要以下一句即可:

# yum install docker-engine

3.启动Docker

一切就绪之后,使用start命令来启动Docker守护进程:

# service docker start

4.输出hello-world

程序员貌似跟hello-world有仇,有事儿没事就打印人家一下,玩docker咱们当前也不例外,先来个hello-world吧,这里的基本原理是利用人家已经写好的hello-world镜像,下载到本地,然后把他运行起来~

使用以下命令:

# docker run hello-world

然后控制端会输出类似于如下的信息,就证明我们的docker环境安装成功了~

在这里,我第一次失败了~显示:

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: net/http: TLS handshake timeout.
See 'docker run --help'.

然后我又来了一次就好了,应该是墙的原因吧,看着是网络访问失败了~

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest Hello from Docker!
This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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 Hub account:
https://hub.docker.com For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

在CentOS 7上安装Docker环境的更多相关文章

  1. 在Centos 7上安装Docker

    在Centos 7上安装Docker 1.docker介绍 docker是类似于vmware的虚拟化软件,可以开发.容纳.运行应用程序的平台,在容器中安全的隔离运行应用程序. 2.Docker引擎 D ...

  2. Install Docker Engine on CentOS 在CentOS 7 上安装Docker

    Install Docker Engine on CentOS OS Requirements 系统要求 To install Docker Engine,you need a maintained ...

  3. CentOS 7上搭建Docker环境

    一.Docker介绍和安装 http://linux.cn/article-4340-1.html Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机 ...

  4. 如何在 CentOS 7 上安装 Docker

    Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止.Docker 帮助系统管理员和程序员在容器中开发应用程序,并且 ...

  5. 【docker】linux系统centOS 7上安装docker

    要求: 一个centOS 7系统  虚拟就上安装CentOS 7步骤 本文操作在本机上使用xshell连接虚拟机上的centOS 7进行操作 1.Docker 要求 CentOS 系统的内核版本高于 ...

  6. CentOS 7上安装Docker 1&period;8

    Docker支持运行在以下CentOS版本: CentOS 7.X 安装在二进制兼容的EL7版本如 Scientific Linux也是可能成功的,但是Docker没有测试过并且不官方支持. 此文带你 ...

  7. CentOS 7上安装Docker

    目录 安装步骤 1.查看Docker的版本 ​ 2.安装 Docker 3.启动Docker 4.设置为开启启动 5.查看Docker安装信息 6.使用Docker 中国加速器 安装步骤 安装操作系统 ...

  8. 在centos linux上安装docker

    前置条件 64-bit 系统 kernel 3.10+ 1.检查内核版本,返回的值大于3.10即可. $ uname -r 2.确保yum是最新的 $ yum update 3.安装 Docker y ...

  9. 在CentOS 7上搭建Docker环境

      Preface       We commonly use VMware or VirtualBox to install our Virtual Machines before.For the ...

随机推荐

  1. X&period;509&comma;RSA&comma;PKCS 普及

    X.509 X.509是一种非常通用的证书格式.所有的证书都符合ITU-T X.509国际标准,因此(理论上)为一种应用创建的证书可以用于任何其他符合X.509标准的应用. 在一份证书中,必须证明公钥 ...

  2. The web application &lbrack;&rsqb; appears to have started a thread named &lbrack;Abandoned connection cleanup thread&rsqb; com&period;mysql&period;jdbc&period;AbandonedConnectionCleanupThread

    01-Jul-2016 14:25:30.937 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoade ...

  3. leetcode 5 &colon;Longest Palindromic Substring 找出最长回文子串

    题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum l ...

  4. 解决浮层弹出如何加上datepicker,并且浮动在上面

    最近在做一个弹出层上弹出的对话框中能弹出一个截止时间的选择框,这个选择框使用datepicker来做. 效果大致是这样的: 但是在做的时候,遇到一个问题,datepicker在弹出层的时候,时间选择框 ...

  5. 【在网页中获取截图数据】Chrome和Firefox下的实战经验

    [转载自我在segmentfault的专栏:https://segmentfault.com/a/1190000004584071] 最近在实现一个功能,需求如下: 前提:当前页面无弹窗 页面任意位置 ...

  6. 全景智慧掌上城,飞入寻常百姓家——VR全景智慧城市

    随着腾讯和阿里陆续将AR技术加入到新年抢红包大战之中,人们对于VR.AR未来的应用空间又多了一些想象.同传统的基于二维元素的抢红包不同,借助VR.AR的技术能够让用户获得一种更加真切的体验,这种体验相 ...

  7. SSH简单项目

    这是我学习SSH整合时的一个测试项目,代码比较简单 整个项目实现从数据库中取数据,在页面上显示.项目的结构如下: (1)数据库设计 数据库使用的是student数据库中的一个数据库表grade,表的内 ...

  8. method&period;invoke&lpar;&rpar;s

    在框架中经常会会用到method.invoke()方法,用来执行某个的对象的目标方法.以前写代码用到反射时,总是获取先获取Method,然后传入对应的Class实例对象执行方法.然而前段时间研究inv ...

  9. 前端阶段&lowbar;html部分

    HTML 1.html5的第一行一定是<!DOCTYPE html>,h4太长,而且一般ide中会自动加载,了解即可. 2.h5的整个页面被<html></html&gt ...

  10. JAVA框架 Spring 事务

    一.我们之前在hibernate的时候,需要直接写事务,需要绑定当前线程保证获取同一个连接,虽然hibernate的帮我们封装绑定当前现成的操作,但是需要我们手动的去开启和关闭事务. 而spring帮 ...