Esthenia-collaboration / rfswarm-docker

Simple docker container wich make rswarm performance tool easy to launch
1 stars 0 forks source link

Create a latest tag in addition of the version tag for every new agent images generated #43

Open Maresther-B opened 1 month ago

Maresther-B commented 1 month ago

Because the latest tag is confusing (the latest tag actually does not necessarily point to the latest version of your image). Let's have a look:

1) When you pull an image without specifying a tag name, Docker will try to pull the image tagged 'latest'

2) When you do not tag an image before your push operation to the registry, Docker will give it the 'latest' tag automatically

3) When you do tag your image and it sounds like that is what you are doing, Docker will never tag anything with 'latest'; You then have to apply the 'latest' tag manually.

So once we build agent images we might do:

$ docker tag /: Build and tag the image with creack/node:latest

$ ID=$(docker build -q -t creack/node .) Add a new tag

$ docker tag $ID creack/node:0.10.24 You can use this and skip the -t part from build

$ docker tag $ID creack/node:latest

Or we might use this:

docker build -t creack/node:latest . ID="$(docker images | grep 'creak/node' | head -n 1 | awk '{print $3}')" docker tag "$ID" creack/node:0.10.24 docker tag "$ID" creack/node:latest

Or this in a shell script:

!/bin/bash

VERSION=1.0.0 IMAGE=company/image ID=$(docker build -t ${IMAGE} . | tail -1 | sed 's/.Successfully built (.)$/\1/')

docker tag ${ID} ${IMAGE}:${VERSION} docker tag -f ${ID} ${IMAGE}:latest