Mongod docker container error when starting via ssh

I installed mongodb on a docker container along with openssh on ubuntu 14.04. The container works with ssh, but when I ssh into the container, I get the following error when trying to start mongod.

root@430f9502ba2d:~# service mongod start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mongod start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mongod

Also start mongodit does not affect anything.

I tried this as well. The Mongon daemon does not start when the mongod service starts , without helping.

mongod --config /your/path/to/mongod.conf also does not work, it just blocks.

The error below is standard, since, of course, the mongod server does not work.

root@430f9502ba2d:/# mongo
MongoDB shell version: 2.6.9
connecting to: test
2015-05-07T20:49:56.213+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-05-07T20:49:56.214+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
+4
source share
2 answers

. Docker init, . , , PID 1 , CMD ENTRYPOINT Dockerfile . ENTRYPOINT, CMD (, /bin/sh -c). mongod Docker CMD, :

CMD usr/bin/mongod

, mongod PID 1. , , : " SSH-?" : SSH- . SSH , "" (, C & C ..) " " :

docker exec -it myContainer /bin/bash

. - Ansible. , , . , Dockerfile config, . ! Dockerizing MongoDB, , ENTRYPOINT Docker, , Dockerfiles.

+5

. Ansible Docker, , Ansible .

mongod --dbpath /var/lib/mongodb --smallfiles

0

All Articles