Connecting php docker to mqtt docker

I am developing an application in IBM Bluemix. I am having two dockers

  1. Mqtt broker docker (https://github.com/mezz64/mqtt-broker-docker-image)

  2. How can you run multiple docker containers from your computer, and have each use a different IP (using a VPN)?
  3. How can I access both ports 8080 and 9990 on bluemix single container for wildfly?
  4. How can I access a docker container via ip address
  5. Passing parameters to Docker container
  6. Error while running "docker-compose up
  7. Interpolate variables in environment variables definition with docker-compose.yml
  8. Php apache based docker(https://github.com/tutumcloud/apache-php)

I am having a python code on my machine through which I intend to publish a message to Mqtt broker. Once published, I want the php docker to subscribe to Mqtt broker docker and display the message.

I am trying to connect to mqtt broker from php docker by giving the address of mqtt docker in php code as follows:

$mqtt = new phpMQTT("169.44.113.133",1883, "PHPMQTTTrial"); //Change client name to something unique

if(!$mqtt->connect()){
echo "failed";
    exit(1);
}
else
{
 echo "Success";
}

$topics['ferries/IOW/#'] = array("qos"=>0, "function"=>"procmsg");
$mqtt->subscribe($topics,0);

while($mqtt->proc()){

echo "hi";

}


$mqtt->close();

function procmsg($topic,$msg){
        echo "Msg Recieved: ".date("r")."\nTopic:{$topic}\n$msg\n";
}

However, it fails to connect.
Can someone guide and tell me how to go about this?

  • Docker open outside ports - not opening the good ones
  • NPM install via git+https//x-oauth-basic within Docker container fails
  • Error response from daemon: Container nova-ca6efe81-f1 is not running
  • How to share an non-storage USB device between host and container on OSX
  • How to get exact date for docker images?
  • docker --insecure-registry flag not working as expected
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.