question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker-entrypoint.sh: connect: Connection refused

See original GitHub issue

Hello, for some reason the image stopped working for me and it’s throwing ERR_EMPTY_RESPONSE.

This is my docker-compose.yml

version: "3"
services:
  node:
    image: "node:alpine"
    user: "node"
    working_dir: /home/node/app
    environment:
    - NODE_ENV=development
    volumes:
    - ./:/home/node/app
    ports:
    - "8888:8888"
    command: "./node_modules/.bin/nodemon server.js"
  mongo:
    image: 'mvertes/alpine-mongo'
    ports:
    - "27017:27017"
    volumes:
    - "./data/db:/data/db"
    links:
      - "mongo-express"
  mongo-express:
    image: 'mongo-express'
    ports:
    - "8081:8081"
mongo-express_1  | /docker-entrypoint.sh: line 14: mongo: Name does not resolve
mongo-express_1  | /docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
mongo-express_1  | Tue Oct  9 15:49:56 UTC 2018 retrying to connect to mongo:27017 (2/5)
mongo-express_1  | /docker-entrypoint.sh: connect: Connection refused
mongo-express_1  | /docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Connection refused
mongo_1          | 2018-10-09T15:49:56.084+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
node_1           | [nodemon] 1.18.3
node_1           | [nodemon] to restart at any time, enter `rs`
node_1           | [nodemon] watching: *.*
node_1           | [nodemon] starting `node server.js`
mongo_1          | 2018-10-09T15:49:56.118+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=5dbfbdb03286
mongo_1          | 2018-10-09T15:49:56.118+0000 I CONTROL  [initandlisten] db version v4.0.1
mongo_1          | 2018-10-09T15:49:56.119+0000 I CONTROL  [initandlisten] git version: 54f1582fc6eb01de4d4c42f26fc133e623f065fb
mongo_1          | 2018-10-09T15:49:56.120+0000 I CONTROL  [initandlisten] OpenSSL version: LibreSSL 2.7.4
mongo_1          | 2018-10-09T15:49:56.120+0000 I CONTROL  [initandlisten] allocator: system
mongo_1          | 2018-10-09T15:49:56.121+0000 I CONTROL  [initandlisten] modules: none
mongo_1          | 2018-10-09T15:49:56.121+0000 I CONTROL  [initandlisten] build environment:
mongo_1          | 2018-10-09T15:49:56.122+0000 I CONTROL  [initandlisten]     distarch: x86_64
mongo_1          | 2018-10-09T15:49:56.123+0000 I CONTROL  [initandlisten]     target_arch: x86_64
mongo_1          | 2018-10-09T15:49:56.123+0000 I CONTROL  [initandlisten] options: { net: { bindIp: "0.0.0.0" } }
mongo_1          | 2018-10-09T15:49:56.129+0000 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
mongo_1          | 2018-10-09T15:49:56.129+0000 I STORAGE  [initandlisten]
mongo_1          | 2018-10-09T15:49:56.129+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
mongo_1          | 2018-10-09T15:49:56.129+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
mongo_1          | 2018-10-09T15:49:56.132+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,co
mpressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
mongo-express_1  | Tue Oct  9 15:49:57 UTC 2018 retrying to connect to mongo:27017 (3/5)
mongo-express_1  | /docker-entrypoint.sh: connect: Connection refused
mongo-express_1  | /docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Connection refused
mongo-express_1  | Tue Oct  9 15:49:58 UTC 2018 retrying to connect to mongo:27017 (4/5)
mongo-express_1  | /docker-entrypoint.sh: connect: Connection refused
mongo-express_1  | /docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Connection refused
mongo-express_1  | Tue Oct  9 15:49:59 UTC 2018 retrying to connect to mongo:27017 (5/5)
mongo-express_1  | /docker-entrypoint.sh: connect: Connection refused
mongo-express_1  | /docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Connection refused
mongo-express_1  | Welcome to mongo-express
mongo-express_1  | ------------------------
mongo-express_1  |
mongo-express_1  |
mongo-express_1  | Mongo Express server listening at http://0.0.0.0:8081
mongo-express_1  | Server is open to allow connections from anyone (0.0.0.0)
mongo-express_1  | basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!
mongo-express_1  |
mongo-express_1  | /node_modules/mongodb/lib/server.js:265
mongo-express_1  |         process.nextTick(function() { throw err; })
mongo-express_1  |                                       ^
mongo-express_1  | MongoError: failed to connect to server [mongo:27017] on first connect
mongo-express_1  |     at Pool.<anonymous> (/node_modules/mongodb-core/lib/topologies/server.js:326:35)
mongo-express_1  |     at emitOne (events.js:116:13)
mongo-express_1  |     at Pool.emit (events.js:211:7)
mongo-express_1  |     at Connection.<anonymous> (/node_modules/mongodb-core/lib/connection/pool.js:270:12)
mongo-express_1  |     at Object.onceWrapper (events.js:317:30)
mongo-express_1  |     at emitTwo (events.js:126:13)
mongo-express_1  |     at Connection.emit (events.js:214:7)
mongo-express_1  |     at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:175:49)
mongo-express_1  |     at Object.onceWrapper (events.js:315:30)
mongo-express_1  |     at emitOne (events.js:116:13)
mongodb-test_mongo-express_1 exited with code 1
mongo_1          | 2018-10-09T15:50:01.843+0000 I STORAGE  [initandlisten] WiredTiger message [1539100201:843819][1:0x7fda7a338960], txn-recover: Main recovery loop: starting at 14/7296
mongo_1          | 2018-10-09T15:50:03.608+0000 I STORAGE  [initandlisten] WiredTiger message [1539100203:608695][1:0x7fda7a338960], txn-recover: Recovering log 14 through 15
mongo_1          | 2018-10-09T15:50:04.487+0000 I STORAGE  [initandlisten] WiredTiger message [1539100204:487750][1:0x7fda7a338960], txn-recover: Recovering log 15 through 15
mongo_1          | 2018-10-09T15:50:05.344+0000 I STORAGE  [initandlisten] WiredTiger message [1539100205:344173][1:0x7fda7a338960], txn-recover: Set global recovery timestamp: 0
mongo_1          | 2018-10-09T15:50:05.403+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
mongo_1          | 2018-10-09T15:50:05.457+0000 I CONTROL  [initandlisten]
mongo_1          | 2018-10-09T15:50:05.458+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
mongo_1          | 2018-10-09T15:50:05.458+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
mongo_1          | 2018-10-09T15:50:05.459+0000 I CONTROL  [initandlisten]
mongo_1          | 2018-10-09T15:50:05.460+0000 I CONTROL  [initandlisten]
mongo_1          | 2018-10-09T15:50:05.461+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
mongo_1          | 2018-10-09T15:50:05.462+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
mongo_1          | 2018-10-09T15:50:05.463+0000 I CONTROL  [initandlisten]
mongo_1          | 2018-10-09T15:50:05.552+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
mongo_1          | 2018-10-09T15:50:05.557+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

Any advice on this? I’m running docker inside an ubuntu vm (18.04.1 LTS)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:18

github_iconTop GitHub Comments

10reactions
pavelgronskycommented, Apr 3, 2019

Add Environment

ME_CONFIG_MONGODB_SERVER: mongo

8reactions
zerukcommented, Apr 14, 2019

I think this could help:

mongo:
  image: mongo
  container_name: mongo
  restart: always
  environment:
    MONGO_INITDB_ROOT_USERNAME: root
    MONGO_INITDB_ROOT_PASSWORD: example
  ports:
    - 27017:27017

mongo-express:
  image: mongo-express
  restart: always
  ports:
    - 8081:8081
  environment:
    ME_CONFIG_MONGODB_ADMINUSERNAME: root
    ME_CONFIG_MONGODB_ADMINPASSWORD: example
  links:
    - "mongo"

I just inserted this in mongo-express service:

links:
    - "mongo"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongo Express server listening at http://0.0.0.0:8081
... that try to connect on localhost, but you need to give container IP ... mongo-express is successfully connected to mongoDB (at the...
Read more >
Startup connection issues between Mongo Express and ...
This article solves one of the problems known as “/docker-entrypoint.sh: connect: Connection refused”. Many developers are struggling with ...
Read more >
Connection refused while connecting to upstream, client ...
When I attempt to access thepage using the IP address the API calls all return 502 bad gateway error on the client. Photo...
Read more >
Nginx connection refused - docker - Server Fault
I'm using docker containers to host a web app. I have three main containers: MySQL, flask and Nginx. The first two work as...
Read more >
Liquibase Docker Compose Testing - ONAP Wiki
config/db:/docker-entrypoint-initdb.d:ro expose: - 3306 liquibase: image: ... "nc: connect to $host port $port (tcp) failed: Connection refused" exit 1 fi.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found