To add a label to a Discourse Docker container and prevent Watchtower from updating it, users can use the --docker-args flag when starting the container or add a labels: stanza to the app.yml file.
Grunskin shared their solution of using ./launcher start app --docker-args "--label com.centurylinklabs.watchtower.enable=false" to add the label.
itsbhanusharma suggested adding the docker args into the app.yml file for a more permanent solution.
vawaver asked for help to exclude the Discourse container from being updated by Watchtower in their Portainer setup, and pfaffman suggested adding a labels: stanza to the app.yml or using ./launcher start-command app to get the docker start command.
vawaver later realized that the Docker image for Discourse is not tagged as latest, which should prevent Watchtower from updating it.
ikarus84 shared a simple solution by adding docker_args: - "--label com.centurylinklabs.watchtower.enable=false" to the app.yml file.
pfaffman clarified that using the labels stanza applies the labels only to the running container, while the docker-args way includes the labels on containers while they are bootstrapping.
ikarus84 asked for the complete stanza for copy-pasting, and vawaver reported that Watchtower updated all other containers except Discourse after setting up the label, but encountered an error.
Just as I was writing a post asking how to add a label to a discourse container I figured it out so I thought I would share here so people my find it easier when googling.
I wanted to add a label to my discourse container so Watchtower wouldn’t try to update it every time.
I just overlooked the help that the launcher script printed and didn’t notice the --docker-args
To add the label I wanted I had to start it with the following:
I had been googling and looking around for over a day and couldn’t find anyone that wanted to do the same thing so I thought I would post this and hopefully someone will find it useful.
I’m currently using Watchtower to monitor and update my Docker containers in Portainer. However, I want to exclude the Discourse container from being updated by Watchtower.
I am not IT pro so I want to ask you for a short tutorial on what exactly I must change in my Watchtower Monitor docker-compose.yml file and other changes in the Discourse configuration.
I am glad for any help.
You can add a labels: stanza to your app.yml to include docker labels on the discourse container when it is started by launcher. Alternately, you can use ./launcher start-command app to see the docker start command and then use whatever you want to use those same ENV variables to start the Discourse container.
You don’t say what Watchtower wants or needs to exclude Discourser from Watchtower, so I can’t tell you any more.
After thinking about it, I realized that the Docker image for Discourse is not tagged as latest. If I’m thinking correctly, Watchtower should be able to detect a newer version of the Discourse Docker image.
Using the labels stanza applies the labels only to the running container while the docker-args way includes the labels on containers while they are bootstrapping (I’m fairly certain).
So I let it run its course. Watchtower updated all other containers except Discourse. Although it showed an error, nothing was broken. @ikarus84 Have you managed to figure out how to set it up correctly to prevent these errors from occurring?