Skip to content

4.4.3: Server selection timeout in mongorestore script inside docker-entrypoint.sh #452

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
victortrusov opened this issue Jan 14, 2021 · 3 comments · Fixed by #454
Closed
Labels
question Usability question, not directly related to an error with the image

Comments

@victortrusov
Copy link

Hi
I'm running mongorestore command to restore dump at the mongo container start using script in docker-entrypoint.sh folder, and it works perfectly in 4.4.2 version.

But I have an error in 4.4.3:

mongodb          | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/restore.sh
mongodb          | 2021-01-14T10:23:09.796+0000 error connecting to host: could not connect to server: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: localhost:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp 127.0.0.1:27017: connect: connection refused }, ] }
mongodb exited with code 1

docker-compose.yml

  mongodb:
    image: mongodb
    build: 
      context: ./db
      dockerfile: Dockerfile
    hostname: mongodb
    container_name: mongodb
    ports:
      - 27017:27017
    command: --bind_ip_all --quiet

db/Dockerfile

FROM mongo:4.4

COPY ./TestDB.agz /dump/
COPY ./restore.sh /docker-entrypoint-initdb.d/
RUN chmod 777 /docker-entrypoint-initdb.d/restore.sh

ENV MONGO_INITDB_DATABASE TestDB

db/restore.sh

mongorestore --gzip --archive=/dump/TestDB.agz
@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jan 14, 2021
@wglambert
Copy link

During initialization the server is now only listening on the unix socket $TMPDIR/mongodb-27017.sock
#443

@drover25
Copy link

mongoimport doesn't seem to work when specifying the host as the unix socket.

A quick google search reveals this ticket from a few years back which was closed as won't fix
https://jira.mongodb.org/browse/TOOLS-620

@yadPe
Copy link

yadPe commented Apr 25, 2022

Please note that temporary server use default port even if you specified one in docker-compose. That was the issue I had

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants