Traccar GPS Tracking System in Docker image.
Official website: https://www.traccar.org
Create work directories:
mkdir -p /var/docker/traccar/logs
Get default traccar.xml:
docker run \
--rm \
--entrypoint cat \
traccar/traccar:latest \
/opt/traccar/conf/traccar.xml > /var/docker/traccar/traccar.xml
Edit traccar.xml: https://www.traccar.org/configuration-file/
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
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.
Content type
Image
Digest
Size
108.4 MB
Last updated
over 6 years ago
docker pull emoneth/traccar-docker