How to upgrade docker container Version?

If you’re new to Docker one thing you might want to know how to upgrade Docker Container Version? In my case, a server, I run Nginx as a Docker container utilizing the official nginx:alpine  model.

Which was working a reasonably outdated model however it must improve with newest version, you may also require such used case to do in your challenge or on your consumer setup.

Let’s begin to put all issues collectively.


$ docker pictures | grep nginx
nginx none 1a35015d99e3 10 months in the past 15.5MB
nginx newest 461749fe2fd 10 months in the past 109MB
nginx 1.11-alpine 935aspbf8ea6 18 months in the past 54.8MB

In an effort to ensure you had the newest version, simply I ran pull:

$ docker pull nginx:alpine
alpine: Pulling from library/nginx
an0fe1bea624: Pull full
d541ba34590b: Pull full
edcbcb324503: Pull full
9fbcep2fc4l5: Pull full
Digest: sha256:c80f0187cc75e1f5002c7ca9841cb191d33c4080f38140b9d6f07802ababbe66
Standing: Downloaded newer picture for nginx:alpine

Now, I’ve the newest model of Nginx picture in my native repository :

$ docker pictures | grep nginx
nginx alpine ep00c21b4edf 5 weeks in the past 16.8MB

To make use of it, I’ve to launch a brand new container primarily based on that newest picture. The at present working container will nonetheless utilize the unique (previous) picture but.

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
3e9de6c0fba1 5a35015d93a0 "nginx -g 'daemon ..." 9 months in the past

In my case, I re-created my webapp/nginx container like this and used following docker command to run my utility over the newest container model

$ docker cease nginx-container

$ docker rm nginx-container

$ docker run --name nginx-container
--net="host"
-v /and so on/nginx/:/and so on/nginx/
-v /and so on/ssl/certs/:/and so on/ssl/certs/
-v /and so on/letsencrypt/:/and so on/letsencrypt/
-v /var/log/nginx/:/var/log/nginx/
--restart=at all times
-d nginx:alpine

Right here we go now and the Nginx/container improve accomplished efficiently. You possibly can run your utility as earlier than.

Conclusion: In above instance as you realized methods to upgrade the container with the newest version to run your application. Used case may be helpful for those who’re working in manufacturing, dev or Sysadmin.

Avatar

About Shachindra Yadav

I, Shachindra Yadav, a Cloud Certified, DevOps and technology enthusiastic person, more passionate to learn and write blogs in my free time.

View all posts by Shachindra Yadav →