zoukankan      html  css  js  c++  java
  • Docker(二):Hello World

    Docker 安装

    这里以CentOS7 为例,其他安装教程可以自行通过其他路径了解。

    Docker 运行在CentOS7 上要求,系统为64位、系统内核版本为3.10以上。

    Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。

    安装前提条件

    安装Docker 之前先确定系统内核版本是否高于3.10.可以通过uname -r命令查看:

    [root@localhost ~]# uname -r
    3.10.0-327.el7.x86_64

    如上结果所示,内核版本为3.10.0,则可以安装Docker,如果你的内核版本低于3.10.0那么请使用yum update命令,进行升级。

    安装Docker

    安装Docker只需要执行yum install docker 命令即可。然后输入y确定安装。

    [root@localhost ~]# yum install docker

    启动Docker

    启动docker 只需要执行systemctl start docker 命令

    [root@localhost ~]#  systemctl start docker

    如果你想开启自动启动docker可以使用 systemctl enable docker.service 命令

    [root@localhost ~]# systemctl enable docker.service

    查看Docker版本

    执行docker version 可以查看docker版本信息。里面包括客服端和服务器的版本信息。

    [root@localhost ~]# docker version
    Client:
     Version:         1.13.1
     API version:     1.26
     Package version: docker-1.13.1-63.git94f4240.el7.centos.x86_64
     Go version:      go1.9.4
     Git commit:      94f4240/1.13.1
     Built:           Fri May 18 15:44:33 2018
     OS/Arch:         linux/amd64
    
    Server:
     Version:         1.13.1
     API version:     1.26 (minimum version 1.12)
     Package version: docker-1.13.1-63.git94f4240.el7.centos.x86_64
     Go version:      go1.9.4
     Git commit:      94f4240/1.13.1
     Built:           Fri May 18 15:44:33 2018
     OS/Arch:         linux/amd64
     Experimental:    false

    Hello world

    下载Hello world 镜像文件,执行命令 docker pull  hello-world 命令,进行下载hello world 镜像文件。

    [root@localhost ~]# docker pull hello-world
    Using default tag: latest
    Trying to pull repository docker.io/library/hello-world ... 
    latest: Pulling from docker.io/library/hello-world
    9bb5a5d4561a: Pull complete 
    Digest: sha256:3e1764d0f546ceac4565547df2ac4907fe46f007ea229fd7ef2718514bcec35d
    Status: Downloaded newer image for docker.io/hello-world:latest

    查看镜像文件使用命令docker images,可以查看所有的镜像文件。

    [root@localhost ~]# docker images
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    docker.io/hello-world   latest              e38bc07ac18e        2 months ago        1.85 kB

    可以看到镜像的名称docker.io/hello-world,镜像的TAG版本为latest表示最新版本,IMAGE ID 表示镜像的ID,CREATE 表示镜像穿件时间, SIZE 表示镜像大小。

    运行镜像文件,使用docker run命令执行 后面可以带 镜像名 或 镜像ID。

    [root@localhost ~]# docker run hello-world
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    ...

    如上表示执行成功,并打印 Hello from Docker 等等信息。

  • 相关阅读:
    图像增强:直方图均衡和小波变换【matlab】
    边缘检测算子和小波变换提取图像边缘【matlab】
    维纳滤波和编码曝光PSF去除运动模糊【matlab】
    编码曝光
    鱼眼镜头的distortion校正【matlab】
    Linux如何查看JDK的安装路径
    Linux启动vi编辑器时提示E325: ATTENTION解决方案
    Linux下useradd命令创建的用户不能登录的问题
    Linux系统下(x64)安装jdk 1.6(jdk-6u45-linux-x64.bin)
    根据wsdl文件,Web工程自动生成webservice客户端调用
  • 原文地址:https://www.cnblogs.com/peter1018/p/9244762.html
Copyright © 2011-2022 走看看