在本地虚拟机 产生一个nginx配置文件 [root@centos-01 dockerfile]# cat weifeng_maintain.conf server { listen 443; server_name localhost ; location / { try_files $uri /index.html; root /data; index index.html index.htm; } }server { listen 80; server_name weifeng.zhi*****h.cn; return 301 https://weifeng.zh*****ch.cn$request_uri;}
index.html 为一个静态维护页面
dockerfile 构建一个 nginx 镜像[root@centos-01 dockerfile]# cat Dockerfile.maintain FROM centosMAINTAINER zh****yitech.cnRUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezoneRUN rm -f /etc/nginx/nginx.confCOPY nginx.conf /etc/nginx/nginx.confWORKDIR / RUN mkdir dataADD nginx.repo /etc/yum.repos.dRUN yum install nginx -yRUN echo "daemon off;" >> /etc/nginx/nginx.confRUN rm -rf /etc/nginx/conf.d/default.confADD weifeng_maintain.conf /etc/nginx/conf.d/COPY index.html /data/RUN useradd -s /sbin/nologin -M wwwEXPOSE 80EXPOSE 443CMD ["nginx"]
构建一个镜像 [root@centos-01 dockerfile]# docker build -t dataline-ui-maintain -f Dockerfile.maintain .******Removing intermediate container 81961244e5d7Step 17/17 : CMD nginx ---> Running in 546522951e90 ---> fb2c43941d01Removing intermediate container 546522951e90Successfully built fb2c43941d01上传镜像到阿里云镜像仓库docker login --username=weifeng -p Z***4dk registry.cn-hangzhou.aliyuncs.com镜像打tagdocker tag weifeng-ui-maintain registry.c*******tem/weifeng-ui-maintain上传镜像到仓库docker push registr******m/weifeng-ui-maintain
在容器服务创建应用和服务
在 路由 ingress 进行变更 为 weifeng-ui-maintain-svc 和 443端口
等页面恢复后, 再将路由 ingress 变更到 正常的ui-svc