Bluemix IBM Container with Mongodb connection failed

I’ve been trying to prepare an image containing mongodb in Docker container from following dockerfile:

# Dockerizing MongoDB: Dockerfile for building MongoDB images
# Based on ubuntu:latest, installs MongoDB following the instructions from:
# http://d...content-available-to-author-only...b.org/manual/tutorial/install-mongodb-on-ubuntu/

# Format: FROM    repository[:version]
FROM       ubuntu:latest

# Format: MAINTAINER Name <email@addr.ess>
MAINTAINER Name <my@gmail.com>

# Installation:
# Import MongoDB public GPG key AND create a MongoDB list file
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo "deb http://r...content-available-to-author-only...b.org/apt/ubuntu     "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee/etc/apt/sources.list.d/mongodb-org-3.0.list

# Update apt-get sources AND install MongoDB
RUN apt-get update && apt-get install -y mongodb-org

# Create the MongoDB data directory
RUN mkdir -p /data/db

# Expose port 27017 from the container to the host
EXPOSE 27017

# Set usr/bin/mongod as the dockerized entry-point application
ENTRYPOINT ["/usr/bin/mongod"]

After running it locally, it all works perfectly but upon running it on Bluemix and assigning to it public IP adress, connection attempt results with following error:

  • A directory created in my web application running inside docker is missing
  • Docker image is not visible when I run docker ps
  • Sharing a Docker container directory which serves as a mount point
  • How to update war files in a docker tomcat container
  • `const_get': uninitialized constant [class] (NameError)` after file save in Docker with Spring
  • App within docker container cannot invoke service on same container
  • $ mongo --host 134.168.37.176
    MongoDB shell version: 2.6.3
    connecting to: 134.168.37.176:27017/test
    2015-11-01T17:24:10.557+0100 Error: couldn't connect to server 134.168.37.176:27017 (134.168.37.176), connection attempt failed at src/mongo/shell/mongo.js:148
    exception: connect failed
    

    This is the image of the container configuraion in bluemix

    Could you tell me why i’m not able to make the connection? Am i doing something wrong?

  • curl_slist_free_all() causes segfault on GKE w/ Debian 8.7
  • Running bvlc-caffe docker image as non-root user results in unexpected NVCC flags
  • logspout write: connection refused
  • How to mount docker socket as volume in docker container with correct group
  • docker-machine and vagrant (in regards of mount volumes)
  • Is there any way to access a docker (nginx) container via a local url like http://mydomain.dev?
  • 2 Solutions collect form web for “Bluemix IBM Container with Mongodb connection failed”

    The error you are having is because port 27017 is not open in IBM Containers.
    I suggest you open a support ticket with IBM Bluemix Support and ask this port to be opened or you can check with IBM Bluemix Support team for an alternative open port you can use as well.

    You can open a support ticket in the following link:

    http://ibm.biz/bluemixsupport

    I believe you will have to just use the private IP for the container. ex. 10.x.x.x. The port 27017 should be open if your application is running also in the IBM Containers. I realize this can be a pain when testing this locally on your own machine, and would be easier to just have the public IP address opening port 27017.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.