This script automates the process of checking for updates to a Docker image from DockerHub, and updating the container if needed.
To run this script, ensure the following software is installed on the target machine:
- Docker: Required to manage containers.
jq: A tool to process JSON (used to parse DockerHub API responses).- Curl: Required to fetch data from DockerHub.
sudo apt-get install jq -y # For Ubuntu/Debian
sudo yum install jq -y # For RHEL/CentOS- Download or create the script.
- Change
VALIDATOR_ENV_PATHto your path. - Make the script executable:
chmod +x image_update.sh- Run the script
./image_update.shThis will:
- Check if the
elixirprotocol/validator:v3image is outdated. - If an update is found, the script will stop the current container, pull the latest image, restart the container, and clean up unused images.