Fix nginx version to 1.28 stable

This commit is contained in:
yeasy
2026-04-28 16:15:39 +00:00
parent 0e0afbd4d3
commit 9c98e35c62
8 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ registry.example.com/myproject/myapp:v1.2.3
## 简写(使用 Docker Hub
nginx:1.30
nginx:1.28
ubuntu:24.04
## 省略标签(默认使用 latest)
+3 -3
View File
@@ -1,6 +1,6 @@
## 2.3 仓库
> **版本说明**本节示例基于 Docker v29.x 和常见镜像版本编写示例中的版本号 `nginx:1.30``mysql:8.0``mysql:5.7` 为演示用途实际使用时请访问 [Docker Hub 官方页面](https://hub.docker.com) 或相应镜像的发布页确认最新可用版本和标签。
> **版本说明**本节示例基于 Docker v29.x 和常见镜像版本编写示例中的版本号 `nginx:1.28``mysql:8.0``mysql:5.7` 为演示用途实际使用时请访问 [Docker Hub 官方页面](https://hub.docker.com) 或相应镜像的发布页确认最新可用版本和标签。
Docker Registry 是镜像分发和管理的核心组件本节将介绍 Registry 的基本概念公共和私有服务的选择以及镜像的安全管理
@@ -73,7 +73,7 @@ registry.example.com/mycompany/myapp:v1.2.3
## Docker Hub 官方镜像(省略 registry 和用户名)
nginx:1.30
nginx:1.28
ubuntu:24.04
## Docker Hub 用户镜像
@@ -217,7 +217,7 @@ $ docker login registry.example.com # 登录其他 Registry
## 拉取镜像
$ docker pull nginx:1.30
$ docker pull nginx:1.28
## 标记镜像(准备推送)
+1 -1
View File
@@ -34,7 +34,7 @@ Starting ──成功──> Healthy ──失败N次──> Unhealthy
#### Web 服务检查
```docker
# 注:nginx 镜像推荐使用具体的版本标签(如 nginx:1.30-alpine
# 注:nginx 镜像推荐使用具体的版本标签(如 nginx:1.28-alpine
FROM nginx
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+1 -1
View File
@@ -176,5 +176,5 @@ $ docker build --target builder -t username/imagename:tag .
上面例子中我们使用 `COPY --from=0 /go/src/github.com/go/helloworld/app .` 从上一阶段的镜像中复制文件我们也可以复制任意镜像中的文件
```docker
COPY --from=nginx:1.30-alpine /etc/nginx/nginx.conf /nginx.conf
COPY --from=nginx:1.28-alpine /etc/nginx/nginx.conf /nginx.conf
```
@@ -128,8 +128,8 @@ RUN set -x ; cd ${LARAVEL_PATH} \
### 7.18.5 最后一个阶段构建 NGINX 镜像
```docker
# 注:nginx 镜像推荐使用具体的版本标签(如 nginx:1.30-alpine
FROM nginx:1.30-alpine as nginx
# 注:nginx 镜像推荐使用具体的版本标签(如 nginx:1.28-alpine
FROM nginx:1.28-alpine as nginx
ARG LARAVEL_PATH=/app/laravel
@@ -179,7 +179,7 @@ $ docker run -dit --rm --network=laravel -p 8080:80 my/nginx
完整的 `Dockerfile` 文件如下
```docker
# 注:生产环境推荐使用具体的版本标签,如 node:20-alpine、composer:2.x、php:8.3-fpm-alpine、nginx:1.30-alpine
# 注:生产环境推荐使用具体的版本标签,如 node:20-alpine、composer:2.x、php:8.3-fpm-alpine、nginx:1.28-alpine
FROM node:20-alpine as frontend
COPY package.json /app/
@@ -229,7 +229,7 @@ RUN set -x ; cd ${LARAVEL_PATH} \
&& chmod -R 777 storage \
&& php artisan package:discover
FROM nginx:1.30-alpine as nginx
FROM nginx:1.28-alpine as nginx
ARG LARAVEL_PATH=/app/laravel
@@ -47,7 +47,7 @@ RUN set -x ; cd ${LARAVEL_PATH} \
&& chmod -R 777 storage \
&& php artisan package:discover
FROM nginx:1.30-alpine as nginx
FROM nginx:1.28-alpine as nginx
ARG LARAVEL_PATH=/app/laravel
+1 -1
View File
@@ -166,7 +166,7 @@ spec:
spec:
containers:
- name: nginx
image: nginx:1.30
image: nginx:1.28
ports:
- containerPort: 80
```
+2 -2
View File
@@ -31,7 +31,7 @@ spec:
spec:
containers:
- name: nginx
image: nginx:1.30
image: nginx:1.28
ports:
- containerPort: 80
```
@@ -73,7 +73,7 @@ kubectl get svc nginx-service
### 13.5.4 步骤 3模拟滚动更新
修改 `nginx-deployment.yaml`将镜像版本改为 `nginx:1.30-alpine`
修改 `nginx-deployment.yaml`将镜像版本改为 `nginx:1.28-alpine`
```bash
kubectl apply -f nginx-deployment.yaml