Docker#
Image information#
The image is available on ghcr.io . The source code is available on GitHub .
Configuring#
An account ID, a license key, and edition ID(s) to update must be provided.
- They can be set via configuration file by setting the environment
variable
GEOIPUPDATE_CONF_FILEto a path inside the container. This file is the same format as GeoIP.conf . Other options may be set in this file as well. - Or they can be set via environment variables:
GEOIPUPDATE_EDITION_IDS- List of space-separated database edition IDs. Edition IDs may consist of letters, digits, and dashes. For example.GeoIP2-Citywould download the GeoIP City database (GeoIP2-City).- One of:
GEOIPUPDATE_ACCOUNT_ID- Your MaxMind account ID.GEOIPUPDATE_ACCOUNT_ID_FILE- A file containing your MaxMind account ID.
- One of:
GEOIPUPDATE_LICENSE_KEY- Your case-sensitive MaxMind license key.GEOIPUPDATE_LICENSE_KEY_FILE- A file containing your case-sensitive MaxMind license key.
The following environment variables are optional:
GEOIPUPDATE_FREQUENCY- The number of hours betweengeoipupdateruns. If this is not set or is set to0,geoipupdatewill run once and exit.GEOIPUPDATE_HOST- The host name of the server to use. The default ishttps://updates.maxmind.com.GEOIPUPDATE_PROXY- The proxy host name or IP address. You may optionally specify a port number, e.g., 127.0.0.1:8888. If no port number is specified, 1080 will be used.GEOIPUPDATE_PROXY_USER_PASSWORD- The proxy user name and password, separated by a colon. For instance,username:password.GEOIPUPDATE_PROXY_USER_PASSWORD_FILE- A file containing the proxy user name and password, separated by a colon.GEOIPUPDATE_PRESERVE_FILE_TIMES- Whether to preserve modification times of files downloaded from the server. This option is either0or1. The default is0.GEOIPUPDATE_VERBOSE- Enable verbose mode. Prints out the steps thatgeoipupdatetakes. Set to1to enable.GEOIPUPDATE_DB_DIR- The directory where geoipupdate will download the databases. The default is/usr/share/GeoIP.
The environment variables can be placed in a file with one per line and
passed in with the --env-file flag. Alternatively, you may pass them in
individually with the -e flag.
Environment variables override any options set in the config file.
GEOIPUPDATE_ACCOUNT_ID, GEOIPUPDATE_LICENSE_KEY and
GEOIPUPDATE_PROXY_USER_PASSWORD each have a _FILE form, for example
GEOIPUPDATE_LICENSE_KEY_FILE. If the _FILE form is set and not empty,
geoipupdate uses the value from the file and ignores the other variable.
geoipupdate removes leading and trailing white space from the contents of the
file. If the file is empty or contains only white space, geoipupdate returns
an error.
Running#
docker run#
Run the latest image with:
docker run --env-file <file> -v <database directory>:/usr/share/GeoIP ghcr.io/maxmind/geoipupdate
<file> should be the environment variable file with your configuration.
<database directory> should be the local directory that you want to download
the databases to.
docker-compose#
Run the latest image with:
version: '3'
services:
geoipupdate:
container_name: geoipupdate
image: ghcr.io/maxmind/geoipupdate
restart: unless-stopped
environment:
- GEOIPUPDATE_ACCOUNT_ID=XXXXXX
- GEOIPUPDATE_LICENSE_KEY=XXXXXXXXXXXXXXXX
- 'GEOIPUPDATE_EDITION_IDS=GeoLite2-ASN GeoLite2-City GeoLite2-Country'
- GEOIPUPDATE_FREQUENCY=72
networks:
- geoipupdate
volumes:
- 'geoipupdate_data:/usr/share/GeoIP'
networks:
geoipupdate:
volumes:
geoipupdate_data:
driver: local
You may also pass your MaxMind account ID and license key as secrets, for example:
version: '3'
services:
geoipupdate:
container_name: geoipupdate
image: ghcr.io/maxmind/geoipupdate
restart: unless-stopped
environment:
- 'GEOIPUPDATE_ACCOUNT_ID_FILE=/run/secrets/GEOIPUPDATE_ACCOUNT_ID'
- 'GEOIPUPDATE_LICENSE_KEY_FILE=/run/secrets/GEOIPUPDATE_LICENSE_KEY'
- 'GEOIPUPDATE_EDITION_IDS=GeoLite2-ASN GeoLite2-City GeoLite2-Country'
- GEOIPUPDATE_FREQUENCY=72
networks:
- geoipupdate
volumes:
- 'geoipupdate_data:/usr/share/GeoIP'
secrets:
- GEOIPUPDATE_ACCOUNT_ID
- GEOIPUPDATE_LICENSE_KEY
networks:
geoipupdate:
volumes:
geoipupdate_data:
driver: local
secrets:
GEOIPUPDATE_ACCOUNT_ID:
file: ./secrets/GEOIPUPDATE_ACCOUNT_ID.txt
GEOIPUPDATE_LICENSE_KEY:
file: ./secrets/GEOIPUPDATE_LICENSE_KEY.txt
Note - When using docker-compose, you need to either:
- set
GEOIPUPDATE_FREQUENCYequal to something greater than 0 or - set
restart: on-failure
If you don’t, the container will continuously restart.