阿里雲ECS服務器,從零搭建 docker服務環境

一、如果有額外購買數據盤,先查看這一篇
【阿里雲】如何掛載阿里雲ESC購買的數據盤

二、
#查詢SELinux的運行模式(關閉模式)
getenforce

SELinux三種模式簡介
Enforcing:強制模式。代表SELinux在運行中,且已經開始限制domain/type之間的驗證關係
Permissive:寬容模式。代表SELinux在運行中,不過不會限制domain/type之間的驗證關係,即使驗證不正確,進程仍可以對文件進行操作。不過如果驗證不正確會發出警告
Disabled:關閉模式。SELinux並沒有實際運行
————————————————

三、安裝包

# 安裝 阿里雲的鏡像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum install epel-release -y

# 安裝 zabbix 的鏡像源
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

# 安裝 zabbix 的命令補充插件
yum install bash-completion -y

yum install bash-completion-extras -y

yum -y update

四、搭建服務器

1-0、阿里雲主機設置swap,防止OOM Killer
https://blog.csdn.net/weixin_42697074/article/details/104028459

1-1、更改 /ect/sysctl.conf 配置,並 sysctl -p 加載啓用

如下:

fs.file-max = 1000000
vm.swappiness = 20
kernel.sysrq = 1
vm.overcommit_memory = 1
vm.max_map_count = 655360
kernel.pid_max = 1000000
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_max_syn_backlog = 102400
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_fin_timeout = 20
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 10
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 102400
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

1-2、安裝 docker 
https://blog.csdn.net/weixin_42697074/article/details/102978629

1-3、修改 docker 默認工作目錄(遷移 /var/lib/docker 目錄)
https://blog.csdn.net/weixin_42697074/article/details/103142768

1-4、docker 鏡像加速
https://blog.csdn.net/weixin_42697074/article/details/103782406

1-5、設置 swarm
https://blog.csdn.net/weixin_42697074/article/details/103472892

1-6、重啓docker  systemctl restart docker 

1-7、配置基於docker容器的springCloud微服務的磁盤使用空間大小
https://blog.csdn.net/weixin_42697074/article/details/105688078


1-8、【docker系列】在Linux系統上安裝 docker-compose
https://blog.csdn.net/weixin_42697074/article/details/105813391

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章