Easiest way to update your Docker containers!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on everybody it's Carmine from bmine Tech and last night somebody commented on one of my videos from Docker bainer asking how we update the containers and portainer so in this video I'm going to show you how we can update it manually or we can update it using Watchtower which is a container that it whole purpose is to update all your containers automatically you can set it on schedule or you can just set it to run one time and it works through to update all your containers it's super convenient and once you get it configured it's great to have have I'm going to show you how to do that in this video so let's get right into it so this is actually a new portainer environment for me I was migrating it from a VM to another little mini PC I'm doing some changes in my infrastructure so this is a new portainer machine and I don't have Watchtower configur so we're actually going to do it on my set of Docker containers so this is just the basic P host template and I'm going to show you how we can do it manually first so the easiest way to come in first would be to you can't really manually pull a painer image but we're going to use Watchtower for that so I'll show you how to do that but the easiest way to upgrade a container is let's say I come to Flame and we're going to come over here and we're going to stop it and once that stops we'll be able to pull if there's an updated container so there's ways to check if you can see if there's an updated container we can come over to dockerhub and we can search on Docker Hub the latest image so I'm just going to search flame dashboard and you might have to work to find the right one so after you find your page you can come through here and it gives you all the information and if we look for it there should be a spot where it has the latest version probably at the top I probably missed it uh we can actually see it so it's been updated hasn't been updated in a year so that's okay but now we know that if we want to recreate it you can see right through here it'll tell you when a container is updated more recently so you can go through all your different Docker containers and you can search to see when they have new images and if you want to update it manually you can do it that way so if I close this back out I would click this recreate button and then I'm going to pull a new image we're going to click recreate and you can see it successfully recreated it was the same image most likely which is okay and now flame is running I find it uh I got to add more pages here it is down at the bottom so it's created and then I just got to click Start and now it's in started successfully I come back over to Flame here's all my dashboard so that's how you would manually update a container manually updating the containers is super simple and it's actually the way I prefer to on certain containers so if you run Pyle or maybe wire guard VPN server those are containers that I don't like to use Watchtower with just just for the pure fact that if Watchtower runs when I'm sleeping or if I'm out of my house and something breaks now my DNS server is broken or my VPN tunnel back in is broken so if I'm away maybe for the weekend and I want to VPN back into my house to fix something I can't because now the VPN tunnel might have been broken because the the tunnel might have not the container might have not upgraded the right way so now I won't be able to Tunnel back in and unless I have another back door I'm going to be locked down till I get home it's the same thing for pie hole if your DNS break your DNS server breaks you won't really be able to do much on the internet so people at your house might not be happy with you if you break that so there are exclusion tags that we can put in on the containers so Watchtower won't upgrade those I'm going to show you how to do that so we're going to use Watchtower next so we're going to install the Watchtower template I'm going to come over to the app template list and again we're using the pi self-hosted template by Nova spirit and this is a little slow today okay here we go we got the Watchtower I spelled it wrong but here's Watchtower it's a very simple container there's nothing to it we're just going to deploy it and then you can see there's their official documentation so if we go into there it's going to give you some information so I'm going to pull the page up so if we come over to the GitHub for Watchtower I actually have the documentation on it it just has some basic info of how to deploy it we want the doc doation so we're going to come over here and there is a lot of information on this page but we're going to look for the arguments and we're going to put an argument so it doesn't update the containers we don't want it to I think this is actually the wrong page there's a lot of pages with different commands in here so it's really tricky okay so here we go so we want to do the filter by disable label so this would actually be the label we're going to put on the containers that we don't want to update and we're going to leave everything else normal so Watchtower knows to update them so Watchtower works by scanning through all your containers and it's going to look if it has this label and we set it to true then it's going to know not to upgrade that that container so this is what I'm going to put on my wire guard in my pie hole so they don't break sorry I misspoke we're going to put this label in and we're actually going to say it's a false and that's going to make it so it doesn't upgrade those containers so I'm just going to copy this line and I'm going to come back over my portainer and I want to make sure that wire guard doesn't upgrade so I'm going to duplicate and edit I'm going to come over here I'm going to add an environmental variable and we're going to come down here I'm going to paste it in I'm going to type in false and then I'm going to redeploy it and you can see it worked it deployed it again okay so now that I've added my tags to my containers that I don't want to upgrade watch Towers pretty much all set up for how I want to use it so if we come over here to the logs it actually tells you what's going on there's no graphical interface to this container it's not going to redirect you to a web page everything's going to be here in the logs so you can see it tells you Watchtower there's no notifications it's going to check all the containers unless we put the disabled label which is what we just put in it's going to tell you when it's going to schedule to run so you can actually schedule to run on certain time periods instead of it just running you know every day or every couple hours or whatever you want or you can do a one time run this is what I usually do so I'm going to change the time frame so pretty much anytime I turn on Watchtower it's going to process an update and then I turn it back off and it finishes updating so I'm going to change this but you can see that it says the first check will be performed in 23 hours so that means tomorrow it's going to run the first check and it's going to upgrade any containers that can be upgraded so I'm going to come back and we're going to adjust this now there was one thing I did miss to set Watchtower to only upgrade by the labels that have the disabled tag in it so it's going to it's going to upgrade all the tag the containers that don't have a tag and disregard the containers that do we do need to add this one tag into the environmental variables again so we're going to copy this and we got to come back into Watchtower we're going to add an environmental variable we're going to click add we're going to set in here we're going to set this one to true so by setting this one to true it's going to make sure that all of the containers that do have the tag won't be upgraded and the ones that don't will be upgraded I know it's kind of confusing if it doesn't really make sense you could read through the documentation like I said there's a lot of different arguments in here so you really got to take some time to understand how to do it but once you do it makes a lot of sense but you got to make sure you set this or it's not going to upgrade the way you want to upgrade okay now that watcht is all set up we do need to tell it I only want it to run once so we need to set that so if we come back into the Container to duplicate and edit I'm going to come down to environmental variables again and we're going to add an environmental variable to run once so we're going to add Watchtower uncore runor once we're going to set this to true so now when we deploy this container it's going to know that we only want to run Watchtower once to cycle through all the containers and update it and then from there we're going to turn it off afterwards so I like to run Watch Tower when I'm watching it it's it's easier when you have an environment that has 25 plus containers because it makes it much easier to work through instead of having to manually recreate the images and there's some containers that you can't upgrade easily through painer so like the actual portainer image can't be upgraded through painer that I've found so far you need to run different commands in the docker line and it's not really my favorite way to do it I know it's probably super simple but I think using watcht is a little bit easier so I'm going to deploy this container and then you can see it was successful and if I come over here into the logs it's running a onetime update so we can actually sit here and watch this and as it runs it's going to scan through all the containers it's looking unless it has the disabled label and it's going to update them all so I'm going to let this run and we're going to come back after it starts working and now if we look we actually see in the Lots it's showing us it found a new container for Sab nzbd and it's going to work it's going to move pull the new image and it's going to recreate it and it's going to update it for us so that's how you can actually tell that it's working at properly and it's going to keep going through all the containers and find all the new ones that can be pulled and update them as we go so another thing to keep in mind is you might want to keep backups of your containers uh periodically usually most of the containers do like the sonar radar uh sain EBD a bunch of those already keep backups t a lot of the ones that we've worked with on this channel do and they have task scheduled that they run backups often so sometimes something might break and you might need to recreate it so make sure you have backups running and maybe save them off your the local machine every now and then as you can just so in case anything does happen as you upgrade a container you have a backup to go back to another thing is you always have the images so here are the old images and you can see like this one's unused and there's another one that's unused as it goes through it's going to keep the new image and all the old images of all the different containers so I know it's in sha and it's kind of tricky to tell but you can tell over here it tells you what's what so you can see this is the old sben zbd container and if I don't want to if I don't like the new one I can go back to the old image but that's just another thing to keep in mind so after watched how it runs you can either configure it to delete the old images or you could have it so it save you know it keeps all the images I don't want to delete the old images just in case but you can always go back afterwards and keep in mind that the old images are going to take up space so I already have two pages of images and you can see there's only a few that aren't being used which is okay but sometimes after you run your environment for a while and you upgrade containers or you run containers and you decide not to use containers anymore there's going to be a bunch of unused images and these images do take up space they look kind of small but if you start getting to a point where let's say you have 15 20 containers they're going to start adding up and depending on how big the drive is for your cont your environment it's going to eat up a lot of your free space so every now and then come back here into containers into the images sorry and you can delete the old ones to make sure you have space that's available so I'm just going to let wat Tower keep working and then when it's all done we'll come back and check it out so now if we come back over here we can see all these containers updated and some of them didn't which is okay but it's all done running and now all my containers that have updates were able to be updated so I'm going to come back over here and I'm going to stop Watchtower just because I don't want it to keep running but now we have containers that have the latest version so updating your portainer containers uh or your Docker containers is super simple and using Watchtower makes it really easy too especially you have a larger Docker environment when you start getting to over 10 containers maybe updating that manually could really be timec consuming so if you're somebody who has maybe 25 or 30 or even more dock containers using Watchtower might take a little time to set up in your environment but it will be super helpful in the long run because it's going to save you a lot of time trying to update it so now when Watchtower is running and painer has an update it will update painer as well there is no update available today in painer but you could always tell by painer will tell you so I'll show you that real quick too so when painer has an update if we look over here in the bottom left corner how it says painer Community Edition it has the version number this will be highlighted in yellow or have a yellow circle it have some sort of indicator and it'll tell you that there's another version available so when there is you can turn on Watchtower and you can have it so it updates painer as well so that's how we use Watchtower and that's how we upgrade our Docker containers manually through painer I hope you guys like this video I hope it helps you out and it's definitely going to be something you're going to need to keep your containers up to date and secure with the latest patches so if you guys can drop a like if you like the video and make sure you subscribe to the channel we have lots of content coming up and we have a new series that's going to be coming out hopefully next week I've been working on the background to get it all set and going and uh I can't wait to share it with you guys I've also been working on the Discord server a lot of people have asked and it just takes a lot of time to set the channels and everything up the way I want but it is coming and I'm hoping by next week I'll be able to share that with everybody and everybody can start joining and we can build our community even larger so thanks for watching I'll see you in the next video
Info
Channel: Barmine Tech
Views: 2,203
Rating: undefined out of 5
Keywords: proxmox, homelab, home lab, ubuntu, networking, docker, portainer, linux, server, home server, virtual machine, virtualmachine, vm, budget, under150, barminetech, barmine tech, tech, technology, computers, computer, network, putty, ssh, ubuntu 22.04, ubuntu 20, devops, dev ops, watchtower, update docker, update portainer
Id: fZRgsfYCF1w
Channel Id: undefined
Length: 13min 51sec (831 seconds)
Published: Fri Jun 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.