Connecting two instance peers

I need to run two different instances of Orthanc and send data from one to the other. The documentation seemed pretty clear so I started two Docker containers on the same machine with the following commands and modified key configuration values:

A:

“HttpPort” : 8042
“DicomPort” : 4242
“OrthancPeers” : {
“peer” : [ “http://127.0.0.1:8043/” ]
}
“RemoteAccessAllowed” : true
“AuthenticationEnabled” : false

docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthancLocal.json:/etc/orthanc/orthanc.json -v orthanc-local-storage:/var/lib/orthanc/db jodogne/orthanc

B:

“HttpPort” : 8043
“DicomPort” : 4243
RemoteAccessAllowed" : true
“AuthenticationEnabled” : false

docker run -p 4243:4243 -p 8043:8043 --rm -v /tmp/orthancLocal2.json:/etc/orthanc/orthanc.json:ro -v orthanc-local-storage2:/var/lib/orthanc/db jodogne/orthanc

After running both A and B, I tried the curl http://localhost:8042/peers?expand command and got:

{
“peer” : {
“HttpHeaders” : [],
“Pkcs11” : false,
“Url” : “http://127.0.0.1:8043/
}
}

Then I tried to test the connection with curl http://localhost:8042/peers/peer/system and got:

{
“Details” : “libCURL error: Couldn’t connect to server”,
“HttpError” : “Internal Server Error”,
“HttpStatus” : 500,
“Message” : “Error in the network protocol”,
“Method” : “GET”,
“OrthancError” : “Error in the network protocol”,
“OrthancStatus” : 9,
“Uri” : “/peers/peer/system”
}

Both A and B versions are up and running but I could not find any information about what might be causing this issue. Any further attempts of sending data via POST also fails as expected. Is there another step I am missing or am I using the peer set up incorrectly?

Hi William,

The problem is by default docker uses bridge networking and in this mode local host refers to the container itself. Not your host machine. See https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach#24326540 for more info.

The easiest way to get around this is change localhost to the up address of your host machine.

Hope that helps.

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Thanks James, that was the problem and it looks like everything is working now.