• Day0-2. Docker安装部署


    2.1 部署环境

    主机名 角色 ip地址
    k8s-master6021.k8s.host.com docker 10.20.60.21
    k8s-master6022.k8s.host.com docker 10.20.60.22
    k8s-master6023.k8s.host.com docker 10.20.60.23
    k8s-node6031.k8s.host.com docker 10.20.60.31
    k8s-node6032.k8s.host.com docker 10.20.60.32
    k8s-node6033.k8s.host.com docker 10.20.60.33
    k8s-harbor60200.k8s.host.com docker 10.20.60.200

    注意:这里部署以 k8s-master6021.k8s.host.com 虚机为例,另外几台虚机安装部署方法类似。

    2.2 安装Docker

    # step 1: 安装必要的一些系统工具
    shell> yum install -y yum-utils device-mapper-persistent-data lvm2
    # Step 2: 添加软件源信息
    shell> yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    # 官方软件源默认启用了最新的软件,安装指定版本的Docker-CE:
    # Step 3: 查找Docker-CE的版本:
    shell> yum list docker-ce.x86_64 --showduplicates | sort -r
    # Step 4: 更新并安装Docker-CE
    shell> yum makecache fast
    shell> yum -y install docker-ce-18.09.9 docker-ce-cli-18.09.9
    

    2.3 配置Docker

    shell> cat > /etc/docker/daemon.json  << "EOF"
    {
      "oom-score-adjust": -1000,
      "registry-mirrors": [
            "https://c6ai9izk.mirror.aliyuncs.com",
            "https://docker.mirrors.ustc.edu.cn"
      ],
      "data-root":"/export/docker",
      "log-driver":"json-file",
      "log-opts":{ "max-size" :"100m","max-file":"1"},
      "insecure-registries": ["harbor.k8s.91donkey.com", "harbor.k8s.maoxj.com.cn", "harbor.k8s.1024byte.info"],
      "storage-driver": "overlay2",
      "storage-opts": [
        "overlay2.override_kernel_check=true"
      ],
      "bip": "172.60.21.1/24",
      "live-restore": true,
      "exec-opts": ["native.cgroupdriver=systemd"]
    }
    EOF
    

    2.4 开启Docker服务

    shell> mkdir -p /export/docker
    shell> systemctl enable docker && systemctl start docker
    shell> docker version
    Client:
     Version: 18.09.9
     API version: 1.39
     Go version: go1.11.13
     Git commit: 039a7df9ba
     Built: Wed Sep 4 16:51:21 2019
     OS/Arch: linux/amd64
     Experimental: false
    
    Server: Docker Engine - Community
     Engine:
      Version: 18.09.9
      API version: 1.39 (minimum version 1.12)
      Go version: go1.11.13
      Git commit: 039a7df
      Built: Wed Sep 4 16:22:32 2019
      OS/Arch: linux/amd64
      Experimental: false
    

    2.5 启动第一个Docker容器

    shell> docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    0e03bdcc26d7: Pull complete
    Digest: sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9
    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/
    
  • 相关阅读:
    keepalived 结合mysql 自动切换
    haproxy 配置日志
    haproxy 配置日志
    keepalive的 nopreempt 非抢占
    keepalive的 nopreempt 非抢占
    keepavlied一些参数
    keepavlied一些参数
    mysql 结合keepalived测试
    【转载】[小红猪]11个物理难题,11种基本粒子 分类: 生活百科 2013-07-26 11:04 317人阅读 评论(0) 收藏
    【转载】上帝粒子证实存在宇宙末日来临?(图) 分类: 生活百科 2013-07-26 11:04 336人阅读 评论(0) 收藏
  • 原文地址:https://www.cnblogs.com/91donkey/p/13366407.html
Copyright © 2020-2023  润新知