title: Can not connect to mongodb container
body: <p>I can not connect to mongodb container created with docker-compose</p>
  
  <p>the mongodb configuration (in docker-compose.yml) is as follow:</p>
  
  <pre><code>mongodata:
    image: mongo:3.0.4
    volumes:
      - /data/db
    command: --break-mongo
  
  mongo:
    image: mongo:3.0.4
    volumes_from:
      - mongodata
    ports:
      - "27017:27017"
    command: --smallfiles --rest --auth
  </code></pre>
  
  <p>When I run:</p>
  
  <blockquote>
    <p>docker-compose ps mongo</p>
  </blockquote>
  
  <p>I got:</p>
  
  <pre><code>      Name                    Command               State            Ports
  ------------------------------------------------------------------------------------
  followit_mongo_1   /entrypoint.sh --smallfile ...   Up      0.0.0.0:27017-&gt;27017/tcp
  </code></pre>
  
  <p>and I cannot connect with mongo client, the bellow command</p>
  
  <blockquote>
    <p>docker-compose run mongo mongo</p>
  </blockquote>
  
  <p>fails and this is the error:</p>
  
  <pre><code>MongoDB shell version: 3.0.4
  connecting to: test
  2015-11-10T17:10:32.735+0000 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
  2015-11-10T17:10:32.741+0000 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
      at connect (src/mongo/shell/mongo.js:179:14)
      at (connect):1:6 at src/mongo/shell/mongo.js:179
  exception: connect failed
  </code></pre>