Docker Community Forums

Share and learn in the Docker community.

Mongodb is not accessible despite --bind_ip set

I use a standard mongo image to run mongodb:

docker run -it -p 27017:27017 mongo --bind_ip 0.0.0.0

It runs ok:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
c765486f9c5f        mongo               "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        0.0.0.0:27017->27017/tcp   great_shannon

and it is accessible via mongo command line tool.

But when I try to access it by mongo-express:

 docker run -it  -p 8081:8081  mongo-express

Nothing works returning:

/docker-entrypoint.sh: line 14: mongo: Name does not resolve
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument

I tried to provide both mongo or great_shannon (name of the mongo container) as ME_CONFIG_MONGODB_SERVER parameter but with the same result.

What am I doing wrong?

Docker version 19.03.1, build 74b1e89
MacOS 10.14.3

1 Like