Ashish Mishra
Ashish Mishra

Reputation: 421

Switching between docker tags

I have an apache,wsgi based python application on ubuntu machine. Application is inside a docker container. Developer fix issue 1, deploy it and gives to tester. Developer fixed issue 2 but can`t deploy since tester is still testing issue 1. Is it possible if developer can create tags in docker image and can switch between them ? He can have 2 different versions of code in two tags or commits, can switch between them whenever he or tester wants.

Upvotes: 0

Views: 304

Answers (1)

Mgccon
Mgccon

Reputation: 425

Each time you commit a container you will get a different image ID. Each of this images can be tagged independently. Example:

docker images
REPOSITORY     TAG         IMAGE ID            CREATED             SIZE                                                                                

python         1.0         e0122ddbfbc5        23 hours ago        100 MB
python         latest      e0122ddbfbc5        23 hours ago        100 MB

Change 1:

docker commit python:1.1
docker images
REPOSITORY     TAG         IMAGE ID            CREATED             SIZE                                                                                

python         1.0         e0122ddbfbc5        23 hours ago        100 MB
python         latest      e0122ddbfbc5        23 hours ago        100 MB
python         1.1         ba130ccb3f66        1 minute ago        101 MB  

Change 2:

docker commit python:1.2
docker images
REPOSITORY     TAG         IMAGE ID            CREATED             SIZE
python         1.0         e0122ddbfbc5        23 hours ago        100 MB
python         latest      e0122ddbfbc5        23 hours ago        100 MB
python         1.1         ba130ccb3f66        10 minute ago        101 MB
python         1.2         946baf236fcc        1 minute ago        101 MB

Once accepted you can tag the image as latest:

docker tag python:1.1 python:latest

or

 docker tag python:1.2 python:latest

Upvotes: 1

Related Questions