• 5
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

MongoDB won't keep running in a Docker container

I want to set up a MongoDB Docker container which would work based on a configuration file I specify. Here it is:

storage:
  dbPath: /data/db/mongodb
  journal:
    enabled: true

systemLog:
  destination: file
  logAppend: true
  path: /data/db/mongod.log

net:
  port: 27017
  bindIp: 127.0.0.1,162.243.243.233

I downloaded the Dockerfile and docker-entrypoint.sh from Docker's GitHub and modified the first one so that it meets my needs. Here's the relevant part of what I've got:

ENV MONGO_MAJOR 3.2
ENV MONGO_VERSION 3.2.6
RUN echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
RUN set -x \
    && apt-get update \
    && apt-get install -y \
            mongodb-org=$MONGO_VERSION \
            mongodb-org-server=$MONGO_VERSION \
            mongodb-org-shell=$MONGO_VERSION \
            mongodb-org-mongos=$MONGO_VERSION \
            mongodb-org-tools=$MONGO_VERSION \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /var/lib/mongodb \
    && mv /etc/mongod.conf /etc/mongod.conf.orig
RUN mkdir -p /data /data/db /data/configdb \
    && chown -R mongodb:mongodb /data /data/db /data/configdb
VOLUME /data /data/db /data/configdb /etc
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

# Add the custom config file
ADD ["mongod.conf","/data"]

EXPOSE 27017

CMD ["mongod", "--config", "/data/mongod.conf"]

When I try to build the image, it succeeds. After docker run it exits as soon as gets created.

When the last line in the Dockerfile looks like CMD ["mongod"], everything's fine, the container's up and running, but accessible only from localhost. According to my mongod.conf, I'm trying to extend the access to my IP address.

The config looks fine and YAML valid. It is also accessible to the container (docker start -ai <CID> gives no entrypoint.sh issue). What's the problem here and how to fix it?

Trending Tags