Create a new folder traccar on your preference.
Create a file named docker-compose.yml into this traccar folder and put the content bellow:
version: '3.9'
services:
postgres:
image: postgres
environment:
POSTGRES_PASSWORD: '${PGSQL_DB_PASSWORD:-postgres}'
POSTGRES_DB: 'traccar'
ports:
- '${PGSQL_DB_PORT:-5432}:5432'
volumes:
- "pgdata:/var/lib/postgresql/data"
traccar:
image: traccar/traccar
hostname: traccar
ports:
- "15000-15005:5000-5005"
- "18082:8082"
volumes:
- ./conf/traccar.xml:/opt/traccar/conf/traccar.xml
volumes:
pgdata:
Create a new dir called conf into traccar folder.
Create a new file into conf folder called traccar.xml and put content bellow:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<entry key='config.default'>./conf/default.xml</entry>
<!--
This is the main configuration file. All your configuration parameters should be placed in this file.
Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
remove "config.default" parameter from this file unless you know what you are doing.
For list of available parameters see following page: https://www.traccar.org/configuration-file/
-->
<entry key='database.driver'>org.postgresql.Driver</entry>
<entry key='database.url'>jdbc:postgresql://postgres:5432/traccar</entry>
<entry key='database.user'>postgres</entry>
<entry key='database.password'>postgres</entry>
</properties>
Execute: docker compose up -d
That`s it! :D