为了http3 的这个模块,所以需要升级nginx的版本,需要nginx1.26.0才有
–with-http_v3_module 这个模块
为什么记录一下?因为觉得奇怪
1:删除nginx镜像,显示镜像还被某个容器在使用
luichun@luichun:~$ docker rmi nginx:latest
Error response from daemon: conflict: unable to remove repository reference "nginx:latest" (must force) - container 05bfcd451e31 is using its referenced image 03861782bd3b
2:通过docker ps 命令查看当前运行的docker容器
结果:显示当前是没有容器在运行
luichun@luichun:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
解决方法
1:停止容器
luichun@luichun:~$ docker stop 05bfcd451e31
05bfcd451e31
2:删除容器–二次删除容器
luichun@luichun:~$ docker rm 05bfcd451e31
05bfcd451e31
luichun@luichun:~$ docker rm 05bfcd451e31
Error response from daemon: No such container: 05bfcd451e31
3:删除nginx镜像
luichun@luichun:~$ docker rmi nginx:latest
Untagged: nginx:latest
Untagged: nginx@sha256:d1c3a4e634ab6b7089dfc0b1e70a401972493e9e16a65b3f655b3a07955571f7
Deleted: sha256:03861782bd3bd54ac209eb40764e3851600bc7c59b2782fc65da7ff629bd8b54
Deleted: sha256:bc2568706140a3fddba85f62a5b19f849340d0e45307fd4e1402e30b40889dc3
Deleted: sha256:ca6863b2a3d7623a6c5b33036ff7b42e4286723d242be0750b5f14d4370c3044
Deleted: sha256:fb39d1ca636d8b05990a26268246641b60283e26a2432e087eec8bae545233dc
Deleted: sha256:708c786290e909197e36af6f57687b7edf3f7f9e17f13a4095f48b13c1baa148
Deleted: sha256:5e238c87da4f01c383b5aeac4c4b23e18857577d45d0ba4f6b83746e522b6fdc
Deleted: sha256:7ddff5277be31f8e292d130b498e1a8dec264f3963f99d46ced3ea7bc7338557
重新下载最新的nginx镜像【nginx:latest是1.25.5】
docker run -d -P nginx:latest
查看nginx镜像
luichun@luichun:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 1d668e06f1e5 6 days ago 188MB
查看这个镜像的历史信息
1 查看这个镜像做过些什么
luichun@luichun:~$ docker history nginx:latest
IMAGE CREATED CREATED BY
03861782bd3b 2 weeks ago CMD ["nginx" "-g" "daemon off;"] 容器启动时要执行的命令为 nginx -g daemon off;
<missing> 2 weeks ago STOPSIGNAL SIGQUIT 使用STOPSIGNAL指令设置了容器的停止信号为SIGQUIT
<missing> 2 weeks ago EXPOSE map[80/tcp:{}] 使用EXPOSE指令暴露了容器的80端口
<missing> 2 weeks ago ENTRYPOINT ["/docker-entrypoint.sh"] 使用ENTRYPOINT指令设置了容器的入口点为/docker-entrypoint.sh
<missing> 2 weeks ago COPY 30-tune-worker-processes.sh /docker-ent… 复制了30-tune-worker-processes.sh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 20-envsubst-on-templates.sh /docker-ent… 复制了20-envsubst-on-templates.sh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 15-local-resolvers.envsh /docker-entryp… 复制了15-local-resolvers.envsh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 10-listen-on-ipv6-by-default.sh /docker… 复制了10-listen-on-ipv6-by-default.sh文件到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY docker-entrypoint.sh / # buildkit 复制了docker-entrypoint.sh 文件到/ 目录中,根目录
<missing> 2 weeks ago RUN /bin/sh -c set -x && groupadd --syst… 执行了一系列命令,包括创建系统用户组等操作
<missing> 2 weeks ago ENV PKG_RELEASE=1~bookworm 设置了环境变量PKG_RELEASE为1~bookworm
<missing> 2 weeks ago ENV NJS_RELEASE=2~bookworm 设置了环境变量NJS_RELEASE为2~bookworm
<missing> 2 weeks ago ENV NJS_VERSION=0.8.4 设置了环境变量NJS_VERSION=0.8.4
<missing> 2 weeks ago ENV NGINX_VERSION=1.25.5 设置了环境变量NGINX_VERSION=1.25.5
<missing> 2 weeks ago LABEL maintainer=NGINX Docker Maintainers <d… 添加了标签
<missing> 4 weeks ago /bin/sh -c #(nop) CMD ["bash"] 使用CMD指令设置了容器启动时要执行的命令为bash
<missing> 4 weeks ago /bin/sh -c #(nop) ADD file:d4bb05cb4d403a78b… 添加了一个文件,但未给出文件名和具体内容。
luichun@luichun:~$
这并不是我想要的nginx的版本,我希望nginx的版本是1.26.0这个版本
通过docker hub 查看nginx
所以我重新删除了这个nginx
luichun@luichun:~$ docker rmi nginx:latest
Error response from daemon: conflict: unable to remove repository reference "nginx:latest" (must force) - container 3a49c535a7bf is using its referenced image 1d668e06f1e5
luichun@luichun:~$ docker stop 3a49c535a7bf
3a49c535a7bf
luichun@luichun:~$ docker rm 3a49c535a7bf
3a49c535a7bf
luichun@luichun:~$ docker rmi nginx:latest
Untagged: nginx:latest
Untagged: nginx@sha256:32e76d4f34f80e479964a0fbd4c5b4f6967b5322c8d004e9cf0cb81c93510766
Deleted: sha256:1d668e06f1e534ab338404ba891c37d618dd53c9073dcdd4ebde82aa7643f83f
Deleted: sha256:682c535e9134a5a3ed2363f4f3157b1775d6909ba09821c89834487cdc987145
Deleted: sha256:8d4ac15aab86b75e75a1f3b4f6606872df9435cd84245e5084a287c3b678f4fc
Deleted: sha256:97747011f58480c1b05123187af96370ee38c15c57a98f0b8da53fcf2042e222
Deleted: sha256:503533d0672e01e9deeff1aaab9495f54783ae70a4036a77ed715208d62f8a50
Deleted: sha256:60f69ec2ab71ac63bcc19f116118e03118eabd578128d2fa75fdd6a476459ed7
Deleted: sha256:e995270c3fe3253ceaa35882876089c2ef357c502ce8f1f7e683946d1fdf6f62
Deleted: sha256:52ec5a4316fadc09a4a51f82b8d7b66ead0d71bea4f75e81e25b4094c4219061
下载nginx1.26.0版本的nginx
docker pull nginx:stable-perl
luichun@luichun:~$ docker pull nginx:stable-perl
stable-perl: Pulling from library/nginx
b0a0cf830b12: Pull complete
13af041419fe: Pull complete
73a2f02e459b: Pull complete
325ea416f2bb: Pull complete
98760cd21ba6: Pull complete
77702ab39408: Pull complete
d095688b3926: Pull complete
cf44434ebd3f: Pull complete
Digest: sha256:0ac31cc6a5dedc5301c01b1cf764f517f34f7fb7c84c8b0cc3f0e9db059a39fe
Status: Downloaded newer image for nginx:stable-perl
docker.io/library/nginx:stable-perlWhat's Next?View a summary of image vulnerabilities and recommendations → docker scout quickview nginx:stable-perl
luichun@luichun:~$
显示出这个nginx的镜像信息
luichun@luichun:~$ docker history nginx:stable-perl
IMAGE CREATED CREATED BY
5e89d2c89523 2 weeks ago RUN /bin/sh -c set -x; NGINX_GPGKEY_PATH… 构建镜像时运行的命令,它设置了一些环境变量并导入了 Nginx 的 GPG 密钥。这可能用于验证软件包的完整性和安全性。--[与nginx:latest不同之处]<missing> 2 weeks ago CMD ["nginx" "-g" "daemon off;"] 容器启动时要执行的命令为 nginx -g daemon off;
<missing> 2 weeks ago STOPSIGNAL SIGQUIT 使用STOPSIGNAL指令设置了容器的停止信号为SIGQUIT
<missing> 2 weeks ago EXPOSE map[80/tcp:{}] 使用EXPOSE指令暴露了容器的80端口
<missing> 2 weeks ago ENTRYPOINT ["/docker-entrypoint.sh"] 使用ENTRYPOINT指令设置了容器的入口点为/docker-entrypoint.sh
<missing> 2 weeks ago COPY 30-tune-worker-processes.sh /docker-ent… 复制了30-tune-worker-processes.sh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 20-envsubst-on-templates.sh /docker-ent… 复制了20-envsubst-on-templates.sh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 15-local-resolvers.envsh /docker-entryp… 复制了15-local-resolvers.envsh文件 到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY 10-listen-on-ipv6-by-default.sh /docker… 复制了10-listen-on-ipv6-by-default.sh文件到/docker-entrypoint.d/目录中,
<missing> 2 weeks ago COPY docker-entrypoint.sh / # buildkit 复制了docker-entrypoint.sh 文件到/ 目录中,根目录
<missing> 2 weeks ago RUN /bin/sh -c set -x && groupadd --syst… 执行了一系列命令,包括创建系统用户组等操作
<missing> 2 weeks ago ENV PKG_RELEASE=1~bookworm 设置了环境变量PKG_RELEASE为1~bookworm
<missing> 2 weeks ago ENV NJS_RELEASE=2~bookworm 设置了环境变量NJS_RELEASE为2~bookworm
<missing> 2 weeks ago ENV NJS_VERSION=0.8.4 设置了环境变量NJS_VERSION=0.8.4
<missing> 2 weeks ago ENV NGINX_VERSION=1.26.0 设置了环境变量NGINX_VERSION=1.26.0 --[与nginx:latest不同之处]
<missing> 2 weeks ago LABEL maintainer=NGINX Docker Maintainers <d… 添加了标签
<missing> 2 weeks ago /bin/sh -c #(nop) CMD ["bash"] 使用CMD指令设置了容器启动时要执行的命令为bash
<missing> 2 weeks ago /bin/sh -c #(nop) ADD file:4b1be1de1a1e5aa60… 添加了一个文件,但未给出文件名和具体内容。
luichun@luichun:~$
运行nginx1.26.0
# nginx -v
nginx version: nginx/1.26.0
# nginx -V
nginx version: nginx/1.26.0
built by gcc 12.2.0 (Debian 12.2.0-14)
built with OpenSSL 3.0.9 30 May 2023 (running with OpenSSL 3.0.11 19 Sep 2023)
TLS SNI support enabled
configure arguments:
--prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--modules-path=/usr/lib/nginx/modules
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--user=nginx --group=nginx --with-compat
--with-file-aio --with-threads
--with-http_addition_module
--with-http_auth_request_module
--with-http_dav_module
--with-http_flv_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_mp4_module
--with-http_random_index_module
--with-http_realip_module
--with-http_secure_link_module
--with-http_slice_module
--with-http_ssl_module
--with-http_stub_status_module
--with-http_sub_module
--with-http_v2_module
--with-http_v3_module
--with-mail
--with-mail_ssl_module
--with-stream
--with-stream_realip_module
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-cc-opt='-g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.26.0/debian/debuild-base/nginx-1.26.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC'
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'