mvertes / docker-alpine-mongo

MongoDB Dockerfile based on light alpine container
MIT License
189 stars 82 forks source link

Share port to real OS #20

Closed DrMartiner closed 6 years ago

DrMartiner commented 7 years ago

Hello everyone

How can I forward mongo port (27017) to a real OS to localhost?

I try to do this, but I had not succeed:

  mongo:
    image: 'mongo:latest'
    restart: always
    expose:
      - 27017
    ports:
      - 27017:27017
# ......
halfer commented 6 years ago

If this is a section of a Docker Compose YAML file, then the - 27017:27017 line should be sufficient. I tend to enclose mine in quotes, like - "27017:27017", but I presume it is not necessary.

However, I would say the bug tracker for this project is not the best place for general Docker Compose questions. Would you ask this on Stack Overflow or somewhere similar? You may need to add more detail though, since what you have here should work.

Note also that the image you are referring to is not mvertes/alpine-mongo - presumably mongo is the one from the official Mongo project?

mvertes commented 6 years ago

The question is not related to this docker image