第一章. Docker平台的安装和配置

  1. 使用VMware创建RockyLinux8.10创建VM,并做基本配置
    VM的配置信息


    image.png
  2. 操作系统基本配置
  • 关闭防火墙: systemctl disable firewalld --now
  • 关闭Selinux: vi /etc/selinux/config
  • 固定IP地址: vi /etc/sysconfig/network-scripts/ifcfg-ens160
    image.png
  • 重启网络: nmctl con reload && nmctl con up ens160
  • 修改主机名为IP地址: hostnamectl set-hostname xs63
  • 安装必备工具: yum install lrzsz vim-enhanced chrony -y
  • 配置时间同步: vim /etc/chrony.conf, 末尾添加:
    server ntp1.aliyun.com iburst
    server ntp2.aliyun.com iburst
    server ntp1.tencent.com iburst
    server ntp2.tencent.com iburst
    开启服务 systemctl enable chronyd --now
    设置计划任务: crontab -e → * 1 * * * /usr/bin/systemctl restart chronyd
  • 修改内核参数: modprobe br_netfilter
    cat > /etc/sysctl.d/docker.conf << EOF
    net.ipv4.ip_forward = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.bridge.bridge-nf-call-ip6tables = 1
    EOF
    sysctl -p /etc/sysctl.d/docker.conf
  1. 安装Docker
  • 安装yum工具: yum install yum-utils -y
  • 添加阿里云源: yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  • 安装Docker和一些工具: yum install docker-ce wget net-tools nfs-utils gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo libaio-devel wget ncurses-devel autoconf automake zlib-devel epel-release openssh-server socat ipvsad mconntrack -y --allowerasing
  • 启动Docker: systemctl enable docker --now
  • 配置镜像加速: tee /etc/docker/daemon.json << EOF
    {
    "registry-mirrors": [
    "https://docker.xuanyuan.me"
    ],
    "insecure-registries": [
    "docker.xuanyuan.me"
    ]
    }
    EOF
    systemctl daemon-reload && systemctl restart docker
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。