• docker系列2-centos7下安装docker


    1、卸载旧版本,没有安装过则跳过

    $ sudo yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-engine

    2、从远程仓库安装

    安装yum-utils工具包(包含了yum-config-manager工具)

    $ sudo yum install -y yum-utils

    安装stable仓库(必须安装)

    $ sudo yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo

    2.1、可选操作:

    启用nightly、test仓库

    $ sudo yum-config-manager --enable docker-ce-test
    $ sudo yum-config-manager --enable docker-ce-nightly

    禁用用nightly仓库

    $ sudo yum-config-manager --disable docker-ce-nightly

    3、安装docker engine 默认安装最新版

    $ sudo yum install docker-ce docker-ce-cli containerd.io

    1)假如需要安装指定版本则,先查出可安装的版本列表,从高到低排列

    $ yum list docker-ce --showduplicates | sort -r

    2)指定版本安装

    $ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

    4、启动docker

    $ sudo systemctl start docker

    5、查看安装版本

    $ docker version

    6、运行hello-world image 测试docker是否正确安装

    $ sudo docker run hello-world
    [root@bogon network-scripts]# sudo docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    0e03bdcc26d7: Already exists 
    Digest: sha256:8e3114318a995a1ee497790535e7b88365222a21771ae7e53687ad76563e8e76
    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:
     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/

    官方文档:https://docs.docker.com/engine/install/centos/

    配置阿里云的镜像加速器

  • 相关阅读:
    Java8系列之重新认识HashMap(转)
    kafka 消费者和生产者测试类
    zookeeper配置
    JNLP应用程序无法打开的解决办法
    Functional Programming 资料收集
    Python的问题解决: IOError: [Errno 32] Broken pipe
    python的subprocess的简单使用和注意事项
    Python tricks(7) -- new-style class的__slots__属性
    Python tricks(6) -- python代码执行的效率
    Python tricks(5) -- string和integer的comparison操作
  • 原文地址:https://www.cnblogs.com/zh-ch/p/12870835.html
Copyright © 2020-2023  润新知