geoipupdate

Docker

Image information

The image is available on ghcr.io. The source code is available on GitHub.

Configuring

The Docker image is configured by environment variables. The following variables are required:

One of:

One of:

The following are optional:

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.

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:

If you don’t, the container will continuously restart.