Here's a simple one, but if you're new to Docker something you might have to look up. On this server, I run Nginx as a Docker container using the official nginx:alpine version.
I was running a fairly outdated version:
$ docker images | grep nginx nginx none 5a35015d93e9 10 months ago 15.5MB nginx latest 46102226f2fd 10 months ago 109MB nginx 1.11-alpine 935bd7bf8ea6 18 months ago 54.8MB
In order to make sure I had the latest version, I ran
$ docker pull nginx:alpine alpine: Pulling from library/nginx 550fe1bea624: Pull complete d421ba34525b: Pull complete fdcbcb327323: Pull complete bfbcec2fc4d5: Pull complete Digest: sha256:c8ff0187cc75e1f5002c7ca9841cb191d33c4080f38140b9d6f07902ababbe66 Status: Downloaded newer image for nginx:alpine
Now, my local repository contains an up-to-date Nginx version:
$ docker images | grep nginx nginx alpine bb00c21b4edf 5 weeks ago 16.8MB
To use it, you have to launch a new container based on that particular image. The currently running container will still be using the original (old) image.
$ docker ps CONTAINER ID IMAGE COMMAND CREATED 4d9de6c0fba1 5a35015d93e9 "nginx -g 'daemon ..." 9 months ago
In my case, I re-created my HTTP/2 nginx container like this;
$ docker stop nginx-container $ docker rm nginx-container $ docker run --name nginx-container \ --net="host" \ -v /etc/nginx/:/etc/nginx/ \ -v /etc/ssl/certs/:/etc/ssl/certs/ \ -v /etc/letsencrypt/:/etc/letsencrypt/ \ -v /var/log/nginx/:/var/log/nginx/ \ --restart=always \ -d nginx:alpine
And the Nginx/container upgrade was completed.