Running Traccar with Docker compose

Rwema Aimable6 years ago

I am trying to run traccar using docker-compose. I followed and adapted the instructions at https://www.traccar.org/docker/

traccar:
        image: tananaev/traccar:3.15-SNAPSHOT
        ports:
           - 5000-5150:5000-5150
           - 8082:8082
        depends_on:
           - mysql
        volumes:
           - ./traccar.xml:/opt/traccar/traccar.xml 
    mysql:
       image: mysql:5.6.30
       environment:
           - MYSQL_DATABASE=traccar
           - MYSQL_USER=traccar
           - MYSQL_ROOT_PASSWORD=traccar
           - MYSQL_PASSWORD=traccar

Trying to access the server on port 8082 gives a 403 forbidden error

Any idea what I may be doing wrong?

Anton Tananaev6 years ago

I don't use Docker myself, so I'm not sure. You need to find a way to access logs to determine what the problem is.

Martin6 years ago

HI! I think you should take a look at this issue I just filled for another traccar docker image https://github.com/magna-z/docker-traccar/issues/9

With that docker file and this proxy conf in apache it works over http:

<Proxy *>
    Allow from localhost
</Proxy>

ProxyPreserveHost On

ProxyPass /api/socket ws://lucas.mgscreativa.com.ar:280/api/socket
ProxyPassReverse /api/socket ws://lucas.mgscreativa.com.ar:280/api/socket

ProxyPass / http://lucas.mgscreativa.com.ar:280/
ProxyPassReverse / http://lucas.mgscreativa.com.ar:280/

Would you please try to get this working with HTTPS?

Thanks!

Martin6 years ago

I think it's:

<Proxy *>
    Allow from localhost
</Proxy>

ProxyPreserveHost On
SSLProxyEngine On
RequestHeader set Front-End-Https "On"

ProxyPass /api/socket ws://xxxxxx.com.ar:280/api/socket
ProxyPassReverse /api/socket ws://xxxxxx.com.ar:280/api/socket

ProxyPass / http://xxxxxx.com.ar:280/
ProxyPassReverse / http://xxxxxx.com.ar:280/

this way I can access https://track.xxxxxx.com

Rod DC5 years ago

is this documentation https://www.traccar.org/docker/ outdated ?

The folder setup/docker does not exist in version: 4.4
sh ./setup/docker/build.sh

What is the best way to run traccar using docker?
Is there a documented way to modify the source code and generate a new docker image to run traccar with it?

Anton Tananaev5 years ago

Yes, it is outdated. Use this:

https://github.com/traccar/traccar-docker