Skip to content

Cannot start container due to the "unknown error" #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DominikStyp opened this issue Jul 22, 2019 · 11 comments
Closed

Cannot start container due to the "unknown error" #358

DominikStyp opened this issue Jul 22, 2019 · 11 comments

Comments

@DominikStyp
Copy link

When i run the image with following docker-compose.yml.
Using command: docker-compose run mongodb or docker-compose up --build (both give same results)

version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

I get this error:

2019-07-22T15:50:26.954+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2019-07-22T15:50:26.957+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-22T15:50:26.960+0000 I CONTROL [main] ERROR: Cannot write pid file to /tmp/docker-entrypoint-temp-mongod.pid: Unknown error
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.

I tried following steps:

  1. docker-compose down
  2. docker system prune
  3. docker-machine restart
  4. removing ALL images and start again

Non of them works. Can anyone help here ?

@wglambert
Copy link

Are you running selinux or apparmor?

Is there anything notable with your environment such as being mac/windows?

@DominikStyp
Copy link
Author

I work on Windows 7 environment. Should this be an issue ?

@wglambert
Copy link

Docker for Windows and Linux Containers on Windows (LCOW) are experimental when running Linux containers, due to the syscall translations and with any host->container volume mounts as Docker for Windows uses VirtualBox https://www.virtualbox.org/ticket/819

LCOW uses Hyper-V however there's still syscall translations for NTFS->POSIX
https://success.docker.com/article/are-linux-containers-on-windows-supported
https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/linux-containers#bind-mounts

You can try Docker named volumes in such cases MariaDB/mariadb-docker#152 (comment)

@DominikStyp
Copy link
Author

Hello I've mounted a volume to /tmp directory where error was showing up.
My current configuration in docker-compose.yml:

version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
    volumes:
      - ./tmp:/tmp

But now other error comes up:
Failed to set up listener: SocketException: Operation not permitted
Log:

mongodb_1  | 2019-07-22T18:28:02.275+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
mongodb_1  | 2019-07-22T18:28:02.278+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
mongodb_1  | 2019-07-22T18:28:02.283+0000 I CONTROL  [initandlisten] MongoDB starting : pid=24 port=27017 dbpath=/data/db 64-bit host=b48031569617
mongodb_1  | 2019-07-22T18:28:02.284+0000 I CONTROL  [initandlisten] db version v4.0.10
mongodb_1  | 2019-07-22T18:28:02.284+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
mongodb_1  | 2019-07-22T18:28:02.284+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
mongodb_1  | 2019-07-22T18:28:02.284+0000 I CONTROL  [initandlisten] allocator: tcmalloc
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten] modules: none
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten] build environment:
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten]     distarch: x86_64
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten]     target_arch: x86_64
mongodb_1  | 2019-07-22T18:28:02.285+0000 I CONTROL  [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 27017, ssl: { mode: "disabled" } }, processManagement: { fork: true, pidFilePath: "/tmp/docker-entrypoint-temp-mongod.pid" }, systemLog: { destination: "file", logAppend: true, path: "/proc/1/fd/1" } }
mongodb_1  | 2019-07-22T18:28:02.286+0000 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Operation not permitted
mongodb_1  | 2019-07-22T18:28:02.286+0000 I CONTROL  [initandlisten] now exiting
mongodb_1  | 2019-07-22T18:28:02.287+0000 I CONTROL  [initandlisten] shutting down with code:48
mongodb_1  | ERROR: child process failed, exited with error number 48
mongodb_1  | To see additional information in this output, start without the "--fork" option.

I use Docker with VirtualBox + DockerTools
I don't have any docker process on the list (so nothing should block the ports).
docker ps shows nothing

@wglambert
Copy link

I'd suggest using the Windows containers https://github.com/docker-library/mongo/tree/master/4.1/windows
Using one of these tags https://github.com/docker-library/docs/tree/master/mongo#supported-tags-and-respective-dockerfile-links

For further help you could try asking the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since this isn't something we can fix in the image, but is a Docker for Windows issue with Linux containers

@DominikStyp
Copy link
Author

This is strange, other linux based containers seem to work without problem like: mysql, nginx, php etc. all virtualized on linuxes like alpine:3.10 works great, but your distribution seems to have problem ubuntu:bionic maybe this is a problem. I can't really use Windows container because i don't think Windows 7 supports it.

@yosifkit
Copy link
Member

Unable to reproduce on Windows 10 Home using docker-toolbox (i.e. docker-machine, boot2docker, and Oracle VirtualBox).

$ docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.12
 Git commit:        774a1f4eee
 Built:             Mon Mar  4 10:36:44 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.4
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       d14af54
  Built:            Wed Mar 27 18:41:10 2019
  OS/Arch:          linux/amd64
  Experimental:     false

$ cat docker-compose.yml
version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

$ docker-compose run mongodb
Creating network "mongo_default" with the default driver
Pulling mongodb (mongo:)...
latest: Pulling from library/mongo
35b42117c431: Pull complete
ad9c569a8d98: Pull complete
293b44f45162: Pull complete
0c175077525d: Pull complete
4e73525b52ba: Pull complete
a22695a3f5e9: Pull complete
c5175bcf2977: Pull complete
3e320da07793: Pull complete
01c6db6b2b5a: Pull complete
3bd6e9d03e78: Pull complete
e03dcf51513f: Pull complete
c1956a9e136a: Pull complete
4c35cf22b1d5: Pull complete
about to fork child process, waiting until server is ready for connections.
forked process: 24
2019-07-22T22:37:50.278+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-07-22T22:37:50.282+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-22T22:37:50.287+0000 I CONTROL  [initandlisten] MongoDB starting : pid=24 port=27017 dbpath=/data/db 64-bit host=07b69c2d9489
2019-07-22T22:37:50.287+0000 I CONTROL  [initandlisten] db version v4.0.10
2019-07-22T22:37:50.288+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-22T22:37:50.289+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-22T22:37:50.290+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-22T22:37:50.291+0000 I CONTROL  [initandlisten] modules: none
2019-07-22T22:37:50.291+0000 I CONTROL  [initandlisten] build environment:
2019-07-22T22:37:50.292+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-07-22T22:37:50.293+0000 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-22T22:37:50.294+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-22T22:37:50.294+0000 I CONTROL  [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 27017, ssl: { mode: "disabled" } }, processManagement: { fork: true, pidFilePath: "/tmp/docker-entrypoint-temp-mongod.pid" }, systemLog: { destination: "file", logAppend: true, path: "/proc/1/fd/1" } }
2019-07-22T22:37:50.295+0000 I STORAGE  [initandlisten]
2019-07-22T22:37:50.296+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-22T22:37:50.296+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-22T22:37:50.297+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-07-22T22:37:50.951+0000 I STORAGE  [initandlisten] WiredTiger message [1563835070:951919][24:0x7fb0d4feba80], txn-recover: Set global recovery timestamp: 0
2019-07-22T22:37:50.959+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-07-22T22:37:50.969+0000 I CONTROL  [initandlisten]
2019-07-22T22:37:50.970+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-22T22:37:50.970+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-22T22:37:50.970+0000 I CONTROL  [initandlisten]
2019-07-22T22:37:50.972+0000 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 92813a1b-5787-402d-a0ad-25fad77a0d2c
2019-07-22T22:37:50.984+0000 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.0
2019-07-22T22:37:50.996+0000 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 791bd120-2b2e-461e-8388-ae4992a44163
2019-07-22T22:37:51.006+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-07-22T22:37:51.009+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
child process started successfully, parent exiting
2019-07-22T22:37:51.014+0000 I STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 40953d3d-b668-4086-acd7-0d0b26fe2e8f
2019-07-22T22:37:51.036+0000 I INDEX    [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
2019-07-22T22:37:51.036+0000 I INDEX    [LogicalSessionCacheRefresh]     building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2019-07-22T22:37:51.042+0000 I INDEX    [LogicalSessionCacheRefresh] build index done.  scanned 0 total records. 0 secs
2019-07-22T22:37:51.104+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:38584 #1 (1 connection now open)
2019-07-22T22:37:51.106+0000 I NETWORK  [conn1] received client metadata from 127.0.0.1:38584 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.10" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } }
2019-07-22T22:37:51.111+0000 I NETWORK  [conn1] end connection 127.0.0.1:38584 (0 connections now open)
2019-07-22T22:37:51.181+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:38586 #2 (1 connection now open)
2019-07-22T22:37:51.182+0000 I NETWORK  [conn2] received client metadata from 127.0.0.1:38586 conn2: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.10" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } }
2019-07-22T22:37:51.226+0000 I STORAGE  [conn2] createCollection: admin.system.users with generated UUID: eecb2488-18db-403d-9c4b-cda36fc66358
Successfully added user: {
        "user" : "root",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}
2019-07-22T22:37:51.248+0000 E -        [main] Error saving history file: FileOpenFailed: Unable to open() file /home/mongodb/.dbshell: Unknown error
2019-07-22T22:37:51.252+0000 I NETWORK  [conn2] end connection 127.0.0.1:38586 (0 connections now open)

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2019-07-22T22:37:51.275+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-07-22T22:37:51.279+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
killing process with pid: 24
2019-07-22T22:37:51.283+0000 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2019-07-22T22:37:51.284+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2019-07-22T22:37:51.284+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2019-07-22T22:37:51.285+0000 I CONTROL  [signalProcessingThread] Shutting down free monitoring
2019-07-22T22:37:51.285+0000 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2019-07-22T22:37:51.286+0000 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2019-07-22T22:37:51.287+0000 I STORAGE  [signalProcessingThread] Shutting down session sweeper thread
2019-07-22T22:37:51.288+0000 I STORAGE  [signalProcessingThread] Finished shutting down session sweeper thread
2019-07-22T22:37:51.398+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2019-07-22T22:37:51.399+0000 I CONTROL  [signalProcessingThread] now exiting
2019-07-22T22:37:51.400+0000 I CONTROL  [signalProcessingThread] shutting down with code:0

MongoDB init process complete; ready for start up.

2019-07-22T22:37:52.363+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-22T22:37:52.367+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=07b69c2d9489
2019-07-22T22:37:52.367+0000 I CONTROL  [initandlisten] db version v4.0.10
2019-07-22T22:37:52.368+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-22T22:37:52.368+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-22T22:37:52.369+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-22T22:37:52.369+0000 I CONTROL  [initandlisten] modules: none
2019-07-22T22:37:52.370+0000 I CONTROL  [initandlisten] build environment:
2019-07-22T22:37:52.370+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-07-22T22:37:52.371+0000 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-22T22:37:52.371+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-22T22:37:52.372+0000 I CONTROL  [initandlisten] options: { net: { bindIpAll: true }, security: { authorization: "enabled" } }
2019-07-22T22:37:52.374+0000 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-07-22T22:37:52.374+0000 I STORAGE  [initandlisten]
2019-07-22T22:37:52.375+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-22T22:37:52.375+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-22T22:37:52.375+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-07-22T22:37:53.205+0000 I STORAGE  [initandlisten] WiredTiger message [1563835073:205244][1:0x7f6ff5b5ca80], txn-recover: Main recovery loop: starting at 1/27264 to 2/256
2019-07-22T22:37:53.303+0000 I STORAGE  [initandlisten] WiredTiger message [1563835073:303547][1:0x7f6ff5b5ca80], txn-recover: Recovering log 1 through 2
2019-07-22T22:37:53.369+0000 I STORAGE  [initandlisten] WiredTiger message [1563835073:369105][1:0x7f6ff5b5ca80], txn-recover: Recovering log 2 through 2
2019-07-22T22:37:53.417+0000 I STORAGE  [initandlisten] WiredTiger message [1563835073:417097][1:0x7f6ff5b5ca80], txn-recover: Set global recovery timestamp: 0
2019-07-22T22:37:53.441+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-07-22T22:37:53.510+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-07-22T22:37:53.512+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

@DominikStyp
Copy link
Author

I'm working on Windows 7 Home Edition + Virtual Box.
When i don't mount additional volume. I get this:


$ docker version

Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.12
 Git commit:        774a1f4eee
 Built:             Mon Mar  4 10:36:44 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       2d0083d
  Built:            Thu Jun 27 18:01:17 2019
  OS/Arch:          linux/amd64
  Experimental:     false

$ cat docker-compose.yml

version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: exampleD
	  
	  
$ docker-compose run mongodb

Pulling mongodb (mongo:)...
latest: Pulling from library/mongo
about to fork child process, waiting until server is ready for connections.
forked process: 24
2019-07-23T16:21:18.661+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-07-23T16:21:18.674+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-23T16:21:18.677+0000 I CONTROL  [main] ERROR: Cannot write pid file to /tmp/docker-entrypoint-temp-mongod.pid: Unknown error
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option

If I add volumes like this:

version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
    volumes:
      - ./tmp:/tmp

I get other error:

$ docker-compose run mongodb
about to fork child process, waiting until server is ready for connections.
forked process: 24
2019-07-23T16:24:33.349+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-07-23T16:24:33.352+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-23T16:24:33.359+0000 I CONTROL  [initandlisten] MongoDB starting : pid=24 port=27017 dbpath=/data/db 64-bit host=91a594661955
2019-07-23T16:24:33.360+0000 I CONTROL  [initandlisten] db version v4.0.10
2019-07-23T16:24:33.360+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-23T16:24:33.360+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-23T16:24:33.360+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-23T16:24:33.361+0000 I CONTROL  [initandlisten] modules: none
2019-07-23T16:24:33.361+0000 I CONTROL  [initandlisten] build environment:
2019-07-23T16:24:33.361+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-07-23T16:24:33.361+0000 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-23T16:24:33.362+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-23T16:24:33.362+0000 I CONTROL  [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 27017, ssl: { mode: "disabled" } }, processManagement: { fork: true, pidFilePath: "/tmp/docker-entrypoint-temp-mongod.pid" }, systemLog: { destination: "file", logAppend: true, path: "/proc/1/fd/1" } }
2019-07-23T16:24:33.363+0000 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Operation not permitted
2019-07-23T16:24:33.363+0000 I CONTROL  [initandlisten] now exiting
2019-07-23T16:24:33.364+0000 I CONTROL  [initandlisten] shutting down with code:48
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

@DominikStyp
Copy link
Author

DominikStyp commented Jul 23, 2019

I tried also to run the container with /bin/bash with following result:

$ docker run -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=example --rm -it mongo /bin/bash

root@0df1a4b4c47f:/# mongod

2019-07-23T17:42:42.514+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-23T17:42:42.518+0000 I CONTROL  [initandlisten] MongoDB starting : pid=17 port=27017 dbpath=/data/db 64-bit host=0df1a4b4c47f
2019-07-23T17:42:42.519+0000 I CONTROL  [initandlisten] db version v4.0.10
2019-07-23T17:42:42.519+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-23T17:42:42.520+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-23T17:42:42.520+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-23T17:42:42.521+0000 I CONTROL  [initandlisten] modules: none
2019-07-23T17:42:42.521+0000 I CONTROL  [initandlisten] build environment:
2019-07-23T17:42:42.521+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-07-23T17:42:42.522+0000 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-23T17:42:42.522+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-23T17:42:42.523+0000 I CONTROL  [initandlisten] options: {}
2019-07-23T17:42:42.524+0000 I STORAGE  [initandlisten]
2019-07-23T17:42:42.525+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-23T17:42:42.525+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-23T17:42:42.526+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-07-23T17:42:43.155+0000 I STORAGE  [initandlisten] WiredTiger message [1563903763:155488][17:0x7fe6f10e6a80], txn-recover: Set global recovery timestamp: 0
2019-07-23T17:42:43.159+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-07-23T17:42:43.178+0000 I CONTROL  [initandlisten]
2019-07-23T17:42:43.178+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-23T17:42:43.179+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-23T17:42:43.179+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-07-23T17:42:43.180+0000 I CONTROL  [initandlisten]
2019-07-23T17:42:43.180+0000 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-07-23T17:42:43.180+0000 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2019-07-23T17:42:43.181+0000 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2019-07-23T17:42:43.181+0000 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-07-23T17:42:43.181+0000 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-07-23T17:42:43.182+0000 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-07-23T17:42:43.182+0000 I CONTROL  [initandlisten]
2019-07-23T17:42:43.185+0000 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 91d2ae5e-2fd8-432b-b085-74773a195f1d
2019-07-23T17:42:43.193+0000 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.0
2019-07-23T17:42:43.199+0000 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 4ba65db3-8683-4918-b7c7-29a4c6b8befb
2019-07-23T17:42:43.206+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-07-23T17:42:43.209+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
2019-07-23T17:42:43.212+0000 I STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 0cee85e6-ba54-43c5-9e93-7c5f32cfc465 2019-07-23T17:42:43.221+0000 I INDEX    [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
2019-07-23T17:42:43.222+0000 I INDEX    [LogicalSessionCacheRefresh]     building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2019-07-23T17:42:43.224+0000 I INDEX    [LogicalSessionCacheRefresh] build index done.  scanned 0 total records. 0 secs

So... it seems to work this way, but.... when i try to connect with mongo-express i get

Mongo Express server listening at http://0.0.0.0:8081
Server is open to allow connections from anyone (0.0.0.0)
basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!

/node_modules/mongodb/lib/server.js:265
        process.nextTick(function() { throw err; })
                                      ^
MongoError: failed to connect to server [mongodb:27017] on first connect
    at Pool.<anonymous> (/node_modules/mongodb-core/lib/topologies/server.js:326:35)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/node_modules/mongodb-core/lib/connection/pool.js:270:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:175:49)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)

Still i can connect to the database from inside the container like this:

root@0df1a4b4c47f:/# mongod &
[1] 82
root@0df1a4b4c47f:/# 2019-07-23T17:55:55.249+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-23T17:55:55.254+0000 I CONTROL  [initandlisten] MongoDB starting : pid=82 port=27017 dbpath=/data/db 64-bit host=0df1a4b4c47f
2019-07-23T17:55:55.254+0000 I CONTROL  [initandlisten] db version v4.0.10
2019-07-23T17:55:55.255+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-23T17:55:55.255+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-07-23T17:55:55.255+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2019-07-23T17:55:55.256+0000 I CONTROL  [initandlisten] modules: none
2019-07-23T17:55:55.256+0000 I CONTROL  [initandlisten] build environment:
2019-07-23T17:55:55.256+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-07-23T17:55:55.257+0000 I CONTROL  [initandlisten]     distarch: x86_64
2019-07-23T17:55:55.257+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2019-07-23T17:55:55.257+0000 I CONTROL  [initandlisten] options: {}
2019-07-23T17:55:55.258+0000 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten]
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-23T17:55:55.260+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2019-07-23T17:55:56.007+0000 I STORAGE  [initandlisten] WiredTiger message [1563904556:7220][82:0x7f860b064a80], txn-recover: Main recovery loop: starting at 2/6144 to 3/256
2019-07-23T17:55:56.107+0000 I STORAGE  [initandlisten] WiredTiger message [1563904556:107712][82:0x7f860b064a80], txn-recover: Recovering log 2 through 3
2019-07-23T17:55:56.168+0000 I STORAGE  [initandlisten] WiredTiger message [1563904556:168825][82:0x7f860b064a80], txn-recover: Recovering log 3 through 3
2019-07-23T17:55:56.225+0000 I STORAGE  [initandlisten] WiredTiger message [1563904556:225579][82:0x7f860b064a80], txn-recover: Set global recovery timestamp: 0
2019-07-23T17:55:56.247+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-07-23T17:55:56.257+0000 I CONTROL  [initandlisten]
2019-07-23T17:55:56.257+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten]
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2019-07-23T17:55:56.260+0000 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-07-23T17:55:56.260+0000 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-07-23T17:55:56.261+0000 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-07-23T17:55:56.261+0000 I CONTROL  [initandlisten]
2019-07-23T17:55:56.276+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-07-23T17:55:56.278+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

root@0df1a4b4c47f:/#
root@0df1a4b4c47f:/#
root@0df1a4b4c47f:/#
root@0df1a4b4c47f:/# mongo
MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-07-23T17:56:02.838+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:48764 #1 (1 connection now open)
2019-07-23T17:56:02.839+0000 I NETWORK  [conn1] received client metadata from 127.0.0.1:48764 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.10" }, os: { type: "Linux", name: "Ubuntu", architecture: "x86_64", version: "16.04" } }
Implicit session: session { "id" : UUID("f8930acb-77d1-49ec-9df3-d01af8324507") }
MongoDB server version: 4.0.10
Server has startup warnings:
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten]
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-07-23T17:55:55.259+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-07-23T17:55:56.257+0000 I CONTROL  [initandlisten]
2019-07-23T17:55:56.257+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-07-23T17:55:56.258+0000 I CONTROL  [initandlisten]
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2019-07-23T17:55:56.259+0000 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2019-07-23T17:55:56.260+0000 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-07-23T17:55:56.260+0000 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-07-23T17:55:56.261+0000 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-07-23T17:55:56.261+0000 I CONTROL  [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
>

.... so something might be up with creating connections by the container

@wglambert
Copy link

When you give a non-mongo command when running the image it bypasses the entrypoint.sh which initializes mongo

@DominikStyp
Copy link
Author

OMG LOL, I finally found out what the issue was:
Out of disk space in docker machine, and that is why my first error was coming up:

ERROR: Cannot write pid file to /tmp/docker-entrypoint-temp-mongod.pid: Unknown error

@wglambert You proposed mount the volume which was actually bad idea, because it was causing the second error:

Failed to set up listener: SocketException: Operation not permitted

But after cleaning up docker VOLUMES, with command:
docker volume rm $(docker volume ls -qf dangling=true)
I finally freed up space, and i managed to run the service with following docker-compose.yml:

version: '3.7'

services:
  mongodb:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
    #restart: always
    ports: ['27017:27017']

  mongo-express:
    image: mongo-express
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example
      # this must correspond to the name of the Mongo DB service name
      ME_CONFIG_MONGODB_SERVER: mongodb

Worth to mention that unfortunately following commands WON'T do the trick:
docker system prune
docker images purge
docker rmi $(docker images -q) --force
Command must clear the volumes specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants