Search code examples
dockerosrm

Unable to run multiple OSRM Docker instances by using multiple port


i am trying to create OSRM Docker for 2 country so first instanaces I created this like

sudo docker run -t -i  -p 192.168.0.2:5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/great-latest.osm.pbf

now i am trying to start the 2nd instances from a different Directory like this

sudo docker run -t -i -p 192.168.0.2:6000:6000  -v $(pwd):/data osrm/osrm-backend osrm-routed --algorithm mld /data/-latest.osm.pbf

but the 2nd one is creating like bellow, it seems to me 2nd one is also referencing to port 5000, I can see port 6000 is open, but it does not take any connection.

docker ps
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                  PORTS                                    NAMES
e5a1a2b3e040        osrm/osrm-backend                "osrm-routed --algor…"   14 seconds ago      Up 13 seconds           5000/tcp, 192.168.0.2:6000->6000/tcp   tender_elbakyan


c9ac75bdcea9        osrm/osrm-backend                "osrm-routed --algor…"   8 days ago          Up 8 days               192.168.0.2:5000->5000/tcp             awesome_murdock

netstat out put

tcp        0      0 192.168.0.2:6000      0.0.0.0:*               LISTEN


telnet  192.168.0.2 6000

i am sure in past it worked.. any help will be really appreciate

Thanks


Solution

  • The last port number in the docker run -p option is the port number inside the container that the server is listening on. This is usually fixed per image, and you probably want it to be 5000 in both cases

    sudo docker run -p 192.168.0.2:5000:5000 ...
    sudo docker run -p 192.168.0.2:6000:5000 ...