What is the proper way to deploy docker application versions?

I have a play framework 2.3 application that I would like to deploy (and keep updating) through the docker. If I release a new version of the application, do I have to create a new docker image every time or create one docker image that downloads and installs my application via git pull / apt-get?

The dockers I have seen so far install applications via apt-get (for example, a postgres image), which would mean deploying a new version of my application. I just needed to restart the container, which would pull the latest version from the private one. deb. Rollback will be unpleasant because I will have to rush to create a new docker to point to a specific version of the package.

An alternative is to create a new image for each version of the application. However, is there a β€œright” way to use dockers?

+6
source share
1 answer

Each time you need to create a new docker image and use part of the tag version (for example :latest and :2.3 ) to help users choose the right option:

 $ docker build -t pavel987/playframework:2.3 . .... # docker builds $ docker tag pavel987/playframework:2.3 pavel987/playframework:latest # Assuming your Docker Hub user name is pavel987 $ docker push pavel987/playframework 

Marking with version number and latest allows your users to automatically use the latest version (since the CLI uses the latest by default) and still allows you to select a consistent version if they do not want something to change (for example :2.3 ). Therefore, in their Dockerfiles, they can use FROM pavel987/playframework:latest if they want to use the latest version, or FROM pavel987/playframework:2.3 if they want to snap their base.

All of this assumes that you want your main distribution to be like a Docker image.

+3
source

Source: https://habr.com/ru/post/973499/


All Articles