From time to time, you need to update your docker containers. And when built with
docker-compose I have a little update-script for you. Nothing incredibly magical here, just a script that runs through the update commands and restarts the container afterwards.
However, I assume your docker container is defined through a
docker-compose.yaml file and built with
#!/usr/bin/env bash CWD=$(pwd) # Make sure we are in the current directory with this script cd $CWD # Check for docker-compose.yaml file if [[ -f "docker-compose.yml" || -f "docker-compose.yaml" ]] then # Updae docker containers docker-compose pull # Restart docker containers docker-compose down docker-compose up -d else echo "'docker-compose.yaml' not found, exiting." exit 1 fi
Save this script and make it executable.
To update, run this script in the directory where the containers
docker-compose.yaml is located.