Sometime, you got to test something out there in a particular environment. You may want to push some test code (adding console.log for example in a UI project) to see what's going on there.

I've encountered one of these situations lately. We already had a what we call WIP environment. So I just start adding some crazy logging inside our UI application then build  the container, tag it WIP, push it to our private docker registry and finally, hit the Redeploy button in Rancher to update it. What was my surprise when I opened the app and didn't see any logging when I was expecting them.

Reflex number one : It probably doesn't figure out I pushed a new image or the server haven't finish digest it yet, let's Redeploy again. Open the site again, bummer, still no  logging.

Reflex number two : Open a shell into that container from Rancher and check the files. BINGO! The files are not the one I was expecting. Thanks to Angular, it was easy to see with the hash added to file names.

So then what's going on? Rancher doesn't pull the latest image. Instead, it use the image he have in his own cache, that match the WIP tag I asked for. Okay, okay, legit. But now, is there a way to force it to pull it from the server each time?

Sure is! You have to configure your Workload to always pull the image on Redeploy. To do so, here's the walk-through :

  1. Edit the workload
Edit Workload

2. Scroll down and go to the advanced options at the bottom.

Show advanced options

3. Finally, expand the Security & Host Config section. You'll then found a section named Pull Image where you only need to select Always.

Security & Host Config

Now, hit the Upgrade button at the bottom of the page and enjoy!

Rancher will now always pull from the repository when redeploying the workload. Hence, you'll be able to reuse the same tag over and over for testing purposes.

Thanks for reading, hope this helps out somebody! :)