Reputation: 2205
I created a new "Container App" in Azure Portal for MongoDB. This used the official MongoDB container from Docker Hub and created an Ubuntu 15.04 box. I have never worked with Docker before.
I am able to SSH into the VM and connect to mongo on the VM. From the ssh session, if I type:
docker ps
I get the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a9af4c2e2b95 mongo "/entrypoint.sh mongo" 34 minutes ago Up 24 minutes 0.0.0.0:27017->27017/tcp compose_mongo_1
However, when I try to connect to Mongo from my local box, I get a connection error that says "Failed to connect to ... after 5000 milliseconds, giving up."
At first I thought it was because the port wasn't opened, but I went to the "Network Security Groups" in Azure portal and allowed port inbound TCP traffic on port 27017.
I am still unable to connect. If anyone could help me, I would appreciate it.
Thanks!
Upvotes: 2
Views: 1944
Reputation: 5113
Ok, A couple of things to keep in mind (and I just tested this end to end, So I am sure it works).
Make sure UFW (Ubuntu Firewall also called Uncomplicated Firewall) denies all forwarded traffic by default, so you need to set it to ACCEPT
sudo nano /etc/default/ufw
Replace
DEFAULT_FORWARD_POLICY="DROP"
With
DEFAULT_FORWARD_POLICY="ACCEPT"
and reload the UFW
sudo ufw reload
this is how I run my docker Image
docker run -p 27017:27017 imageid &
Add the endpoint for port 27017 - from your azure portal for this VM (Which you have already done)
this is it, I think you should be all set now...
Upvotes: 4