Last update at :2024-02-05,Edit by888u
Watchtower will automatically keep all your running Docker containers up to date. This is useful if you use Docker to run any self-hosted services or applications. Every few minutes, Watchtower pulls the latest image for your application and compares it to the image used to run the container. Suppose there are any changes to the image, in which case Watchtower will automatically restart the container with the new image and use the docker run or docker-compose configuration that was originally used to start it.
This tutorial explains how to install Watchtower on Ubuntu 20.04.
Watchtower official website: https://containrrr.dev/watchtower/
1. Preparatory work
1. Prepare a Debian/Ubuntu system
Systems running on Debian or Ubuntu. Other Linux distributions that use the APT package manager can also be used.
2. Connect to SSH
Secondly, we need to connect to the Banwagonhost VPS via SSH before we can perform a series of operations.
3. Update system
sudo apt update && sudo apt upgrade2. Watchtower installation tutorial
1. Install Docker
Ideally, you should already have Docker installed on your server since you should already be using it. If not, you can install it by following these steps:
1. Delete all old versions of Docker:
$ sudo apt remove docker docker-engine docker.io containerd runc2. Install Docker through snap:
$ sudo snap install docker2. Install Watchtower
If you don't have a Docker container running, create one. For example, you can use the Docker starter image.
$ sudo docker run -d -p 80:80 docker/getting-startedTo check if you have any existing running containers, you can run docker ps.
1. Create a Watchtower container
$ sudo docker run --detach \ --name watchtower \ --volume /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower2. Check whether the Watchtower container is running
$ sudo docker ps STATUS Up x seconds/minutesYou have now successfully installed and configured Watchtower to regularly update your Docker container images.
3. Additional settings
Watchtower has some additional configuration that can be changed using command line parameters.
1. Set time zone
You can set the time zone used by Watchtower by mounting the host's /etc/localtime file into the container.
$ sudo docker run --detach \ --name watchtower \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume /etc/localtime:/etc/localtime:ro \ containrrr/watchtower2. Automatically delete old images
By default, Watchtower does not delete old images. It may be useful to enable this feature if you need to save disk space.
$ sudo docker run --detach \ --name watchtower \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume /etc/localtime:/etc/localtime:ro \ containrrr/watchtower \ --cleanup4. Discounts for bricklayers
Recommended solutions for bricklayers
Real-time inventory of bricklayers: https://stock.bwg.net
Warm reminder: If you have difficulty choosing, just choose the CN2 GIA-E plan in the middle. The quarterly payment is $49.99, and you can switch between up to 12 computer rooms at will.CN2 (cheapest) | 1GB | 1 core | 20GB | 1TB | 1Gbps | DC3 CN2 DC8 ZNET | $49.99/year | Buy |
CN2 | 2GB | 1 core | 40GB | 2TB | 1Gbps | $52.99/half year $99.99/year | Buy | |
CN2 GIA-E (most recommended) | 1GB | 2 cores | 20GB | 1TB | 2.5Gbps | DC6 CN2 GIA-E DC9 CN2 GIA Japan Softbank JPOS_1 Netherlands EUNL_9 | $49.99/quarter $169.99/year | Buy |
CN2 GIA-E | 2GB | 3 core | 40GB | 2TB | 2.5Gbps | $89.99/quarter $299.99/year | Buy | |
HK | 2GB | 2 cores | 40GB | 0.5TB | 1Gbps | Hong Kong, China CN2 GIA | $89.99/month $899.99/year | Buy |
HK | 4GB | 4 core | 80GB | 1TB | 1Gbps | $155.99/month $1559.99/year | Buy | |
TOKYO | 2GB | 2 cores | 40GB | 0.5TB | 1.2Gbps | Tokyo, Japan CN2 GIA | $89.99/month $899.99/year | Buy |
TOKYO | 4GB | 4 core | 80GB | 1TB | 1.2Gbps | $155.99/month $1559.99/year | Buy | |
Select a suggestion:
- Getting started: Los Angeles CN2 package, currently the cheapest, optional CN2 GT computer room, the entry-level choice.
- Recommendation: Los Angeles CN2 GIA-E package, super fast, with many optional computer rooms (DC6, DC9, Japan SoftBank, Netherlands Unicom, etc.), the most cost-effective.
- High-end: Hong Kong CN2 GIA package, the price is higher, but impeccable. Tokyo CN2 GIA package is also a very good high-end choice.
Recommended site search: American independent host, permanent free cloud server address, online server website, .net virtual host Taiwan server rental international domain name, virtual space, cm domain name registration, free proxy IP, domain name,
发表评论