Nginx:alpine vs nginx:1.17-alpine

I’ve encountered two different image tags: nginx:alpine and nginx:1.17-alpine in different docker-compose.yml files. What’s is the difference between them? I haven’t found a nginx:alpine tag in nginx official image on docker hub.

Both tags exist on Dockerhub and both tags are mutable. Whenever a new nginx version is realeased a new alpine based image is build and tagged as nginx:alpine. Whenever a new nginx bugfix version of 1.17 is released a new alpine based image image is build and tagges as nginx:1.17-alpine.

It appears that 1.17 is the current majo.minor version, both images will point to the same image. When version 1.18 or later will apear, the tag nginx:alpine will point to that version, while the nginx:1.17-alpine image will still point to the latest image for nginx 1.17.x

Inspect both images your self:

docker pull nginx:alpine
docker pull nginx:1.17-alpine
docker inspect nginx:alpine --format '{{json .Config.Env }}'
docker inspect nginx:1.17-alpine --format '{{json .Config.Env }}'

Check the value of the variable NGINX_VERSION in both the docker inspect outputs.

Usualy you will want to stick with the nginx:major.minor-alpine tag, as the configuration should remain stable between bugfix versions, while using nginx:alpine might leave you with a broken configuraiton one day.

1 Like