You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Maxim Zalysin 55da9a4b40 Update to v5.2 2 years ago
.github/workflows Update to v5.1 2 years ago
Dockerfile.alpine Update to v5.2 2 years ago
Dockerfile.debian Update to v5.2 2 years ago
Dockerfile.ubuntu Update to v5.2 2 years ago
README.md Update to v5.2 2 years ago

README.md

Traccar in Docker

Traccar GPS Tracking System in Docker image.

Official website: https://www.traccar.org
DockerHub image: https://hub.docker.com/r/traccar/traccar
Maintainer: Maxim Zalysin

Available tags:

5.X

  • 5.2-alpine, 5-alpine, alpine, 5.2, 5, latest
  • 5.2-debian, 5-debian, debian
  • 5.2-ubuntu, 5-ubuntu, ubuntu
  • 5.1-alpine, 5.1
  • 5.1-debian
  • 5.1-ubuntu
  • 5.0-alpine, 5.0
  • 5.0-debian
  • 5.0-ubuntu

4.X

  • 4.15-alpine, 4.15
  • 4.15-debian
  • 4.15-ubuntu
  • ...
  • 4.0-alpine, 4.0
  • 4.0-debian

3.X

  • 3.17-alpine, 3.17
  • 3.17-debian
  • 3.16-alpine, 3.16
  • 3.16-debian

Available multi-platform images:

Alpine based: linux/amd64
Debian based: linux/amd64, linux/arm64/v8
Ubuntu based: linux/amd64, linux/arm/v7, linux/arm64/v8

Container create example:

  1. Create work directories:

    mkdir -p /var/docker/traccar/logs
    
  2. Get default traccar.xml:

    docker run \
    --rm \
    --entrypoint cat \
    traccar/traccar:latest \
    /opt/traccar/conf/traccar.xml > /var/docker/traccar/traccar.xml
    
  3. Edit traccar.xml: https://www.traccar.org/configuration-file/

  4. Create container:

    docker run \
    -d --restart always \
    --name traccar \
    --hostname traccar \
    -p 80:8082 \
    -p 5000-5150:5000-5150 \
    -p 5000-5150:5000-5150/udp \
    -v /var/docker/traccar/logs:/opt/traccar/logs:rw \
    -v /var/docker/traccar/traccar.xml:/opt/traccar/conf/traccar.xml:ro \
    traccar/traccar:latest
    

Database

The default when executing the above docker run command is an internal H2 database but this should only be for basic use.
The docker run command also doesn't create a mount point on the host for the data folder which will cause the database to be lost when the container is recreated. This point can be mitigated by adding the line -v /var/docker/traccar/data:/opt/traccar/data:rw \ after -v /var/docker/traccar/traccar.xml:/opt/traccar/conf/traccar.xml:ro \ but it will still be using the H2 database.
The recommended solution for production use is to link to an external MySQL database and update the configuration .xml-file according to the Traccar MySQL documentation and using the docker run command as-is.

Default JVM options:

  • -Xms512m
  • -Xmx512m
  • -Djava.net.preferIPv4Stack=true