Mongodb installation on Docker

I’ve been trying for a while now to install mongodb on my docker image in a variety of ways. I’ve tried using the official image by calling ‘docker pull mongo:latest’ but for some reason the terminal just hangs with no feedback from docker. I’ve also tried various ways to build it through Dockerfile but run into an issue when trying to configure mongodb-org-server.

What is the correct way to install mongodb on my docker image? The easiest, I would presume, is to use the docker image for mongo but that’s just freezing.

  • Unable to run docker project in localhost
  • Docker container not starting
  • Cant get a Docker image with apache to display the test webpage
  • Apache Marathon: Pod/Compose like?
  • Issues with Restcomm Docker image
  • How to connect to mysql running on docker using Sequel Pro
  • Dockerfile

    FROM ubuntu:12.04
    FROM ruby:2.2.0
    RUN apt-key adv --keyserver hkp:// --recv 7F0CEB10
    RUN echo "deb precise/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
    RUN apt-get update -qq
    RUN apt-get upgrade -y
    RUN apt-get install -y build-essential libpq-dev nodejs mongodb-org tcl8.5
    # Install redis
    RUN wget
    RUN tar xzf redis-stable.tar.gz
    WORKDIR redis-stable
    RUN make
    RUN make install
    WORKDIR utils
    RUN ./
    RUN service redis_6379 start
    RUN mkdir /myapp
    WORKDIR /myapp
    ADD . /myapp
    RUN mv redis.conf /etc/redis/redis.conf.default
    RUN redis-server &
    #RUN bundle install
    #RUN RAILS_ENV=development bundle exec rake assets:precompile --trace
    RUN service mongod status
    #RUN rake db:mongoid:create_indexes
    CMD ["rails", "server", "-b", ""]


    Step 6 : RUN apt-get install -y build-essential libpq-dev nodejs mongodb-org tcl8.5
     ---> Running in bc29e517b3a9
    Reading package lists...
    Building dependency tree...
    Reading state information...
    build-essential is already the newest version.
    libpq-dev is already the newest version.
    The following package was automatically installed and is no longer required:
    Use 'apt-get autoremove' to remove it.
    The following extra packages will be installed:
      libc-ares2 libtcl8.5 libv8-3.14.5 mongodb-org-mongos mongodb-org-server
      mongodb-org-shell mongodb-org-tools
    Suggested packages:
    The following NEW packages will be installed:
      libc-ares2 libtcl8.5 libv8-3.14.5 mongodb-org mongodb-org-mongos
      mongodb-org-server mongodb-org-shell mongodb-org-tools nodejs tcl8.5
    0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
    Need to get 53.6 MB of archives.
    After this operation, 168 MB of additional disk space will be used.
    Get:1 precise/mongodb-org/3.0/multiverse mongodb-org-shell amd64 3.0.6 [4258 kB]
    Get:2 jessie/main libtcl8.5 amd64 8.5.17-1 [737 kB]
    Get:3 precise/mongodb-org/3.0/multiverse mongodb-org-server amd64 3.0.6 [8632 kB]
    Get:4 jessie/main libc-ares2 amd64 1.10.0-2 [76.7 kB]
    Get:5 jessie/main nodejs amd64 0.10.29~dfsg-2 [648 kB]
    Get:6 jessie/main tcl8.5 amd64 8.5.17-1 [58.6 kB]
    Get:7 jessie/main libv8-3.14.5 amd64 [1269 kB]
    Get:8 precise/mongodb-org/3.0/multiverse mongodb-org-mongos amd64 3.0.6 [4043 kB]
    Get:9 precise/mongodb-org/3.0/multiverse mongodb-org-tools amd64 3.0.6 [33.8 MB]
    Get:10 precise/mongodb-org/3.0/multiverse mongodb-org amd64 3.0.6 [3616 B]
    debconf: delaying package configuration, since apt-utils is not installed
    Fetched 53.6 MB in 11s (4850 kB/s)
    Selecting previously unselected package libtcl8.5:amd64.
    (Reading database ... 27887 files and directories currently installed.)
    Preparing to unpack .../libtcl8.5_8.5.17-1_amd64.deb ...
    Unpacking libtcl8.5:amd64 (8.5.17-1) ...
    Selecting previously unselected package libc-ares2:amd64.
    Preparing to unpack .../libc-ares2_1.10.0-2_amd64.deb ...
    Unpacking libc-ares2:amd64 (1.10.0-2) ...
    Selecting previously unselected package libv8-3.14.5.
    Preparing to unpack .../libv8-3.14.5_3.14.5.8-8.1_amd64.deb ...
    Unpacking libv8-3.14.5 ( ...
    Selecting previously unselected package mongodb-org-shell.
    Preparing to unpack .../mongodb-org-shell_3.0.6_amd64.deb ...
    Unpacking mongodb-org-shell (3.0.6) ...
    Selecting previously unselected package mongodb-org-server.
    Preparing to unpack .../mongodb-org-server_3.0.6_amd64.deb ...
    Unpacking mongodb-org-server (3.0.6) ...
    Selecting previously unselected package mongodb-org-mongos.
    Preparing to unpack .../mongodb-org-mongos_3.0.6_amd64.deb ...
    Unpacking mongodb-org-mongos (3.0.6) ...
    Selecting previously unselected package mongodb-org-tools.
    Preparing to unpack .../mongodb-org-tools_3.0.6_amd64.deb ...
    Unpacking mongodb-org-tools (3.0.6) ...
    Selecting previously unselected package mongodb-org.
    Preparing to unpack .../mongodb-org_3.0.6_amd64.deb ...
    Unpacking mongodb-org (3.0.6) ...
    Selecting previously unselected package tcl8.5.
    Preparing to unpack .../tcl8.5_8.5.17-1_amd64.deb ...
    Unpacking tcl8.5 (8.5.17-1) ...
    Selecting previously unselected package nodejs.
    Preparing to unpack .../nodejs_0.10.29~dfsg-2_amd64.deb ...
    Unpacking nodejs (0.10.29~dfsg-2) ...
    Processing triggers for systemd (215-17+deb8u2) ...
    Setting up libtcl8.5:amd64 (8.5.17-1) ...
    Setting up libc-ares2:amd64 (1.10.0-2) ...
    Setting up libv8-3.14.5 ( ...
    Setting up mongodb-org-shell (3.0.6) ...
    Setting up mongodb-org-server (3.0.6) ...
    Adding system user `mongodb' (UID 105) ...
    Adding new user `mongodb' (UID 105) with group `nogroup' ...
    Not creating home directory `/home/mongodb'.
    Adding group `mongodb' (GID 109) ...
    Adding user `mongodb' to group `mongodb' ...
    Adding user mongodb to group mongodb
    invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
    dpkg: error processing package mongodb-org-server (--configure):
     subprocess installed post-installation script returned error exit status 100
    Setting up mongodb-org-mongos (3.0.6) ...
    Setting up mongodb-org-tools (3.0.6) ...
    dpkg: dependency problems prevent configuration of mongodb-org:
     mongodb-org depends on mongodb-org-server; however:
      Package mongodb-org-server is not configured yet.
    dpkg: error processing package mongodb-org (--configure):
     dependency problems - leaving unconfigured
    Setting up tcl8.5 (8.5.17-1) ...
    Setting up nodejs (0.10.29~dfsg-2) ...
    update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
    Processing triggers for libc-bin (2.19-18+deb8u1) ...
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Service 'web' failed to build: The command '/bin/sh -c apt-get install -y build-essential libpq-dev nodejs mongodb-org tcl8.5' returned a non-zero code: 100

  • Can't connect to MySQL docker container launched via ansible
  • howto: elastic beanstalk + deploy docker + graceful shutdown
  • How to connect to a docker daemon listening to ssl/tls connections over <HostVMIP>:2376 using Java?
  • DOCKER installation ERROR “Internal error: Failed to expand shell folder constant ”userdocs" on Windows
  • Ignore files in Google App Engine managed VM
  • What are the possible states for a docker container?
  • One Solution collect form web for “Mongodb installation on Docker”

    I think this is a duplicate of

    Summary: you’re trying to install a new version of MongoDB which is packaged for Upstart init services, but the version of Ubuntu you’re running still uses SysV init scripts.

    Any reason you’re using such an old Ubuntu version (12.04)?

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