在本地虚拟机 产生一个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 centos
MAINTAINER zh****yitech.cn RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone RUN rm -f /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf WORKDIR / RUN mkdir data ADD nginx.repo /etc/yum.repos.d
RUN yum install nginx -y
RUN echo "daemon off;" >> /etc/nginx/nginx.conf RUN rm -rf /etc/nginx/conf.d/default.conf ADD weifeng_maintain.conf /etc/nginx/conf.d/ COPY index.html /data/ RUN useradd -s /sbin/nologin -M www EXPOSE 80
EXPOSE 443 CMD ["nginx"]
构建一个镜像 [root@centos-01 dockerfile]# docker build -t dataline-ui-maintain -f Dockerfile.maintain . ****** Removing intermediate container 81961244e5d7
Step 17/17 : CMD nginx
---> Running in 546522951e90
---> fb2c43941d01
Removing intermediate container 546522951e90
Successfully built fb2c43941d01 上传镜像到阿里云镜像仓库 docker login --username=weifeng -p Z***4dk registry.cn-hangzhou.aliyuncs.com 镜像打tag docker 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