4 Usage
Noccy edited this page 2022-09-04 15:11:20 +00:00

Basic usage

Using Fresh is as simple as falling off a log. Just run it while in a directory that contains a docker-compose.yml file, and Fresh will go and check for updates to any registries you have authenticated against. This means it currently can't be used to check images from dockerhub, but it works great for private registries.

Limiting updates

When using docker-compose, Fresh will call on docker-compose pull and docker-compose up without any parameters causing all updated images to be fetched. This may not be desired however, in which case you can get more control over what is updated by using the --updated or --only flags.

# Update everything
$ fresh.phar

# Only update the images alpha and beta whenever new images exist for any service
$ fresh.phar --only alpha,beta

# Only update the services that have updated
$ fresh.phar --updated

Checking only

To just check for updates, use the --check option. The exitcode will be set if there are new images available, and you can do your own magic. This can be combined with --image to check a specific image:

# Call on update.sh if new stuff exists
$ fresh.phar --check || ./update.sh

Notifications and Hooks

Slack/Mattermost Webhooks

Fresh can invoke a Slack-compatible webhook to notify before anything is actually updated. To do this, use the --slack flag followed by the webhook URL:

# Notify something
$ fresh.phar --slack https://my.server.tld/url

Script hooks

You can specify a script to run after an update by using the --after flag.

# Do something
$ fresh.phar --after /path/to/fix-stuff.sh

Scheduled run

Using cron

Using Systemd