Docker Community Forums

Share and learn in the Docker community.

Connect to mongodb in one docker network

I have three containers running in one network, one of them has mongodb inside.

here is container #1:

 docker run --restart=always \
        --name dmz-test \
        --network=e2e-test-network \
        -p 3035:3030 \
        -v /home/kai/work/root/tests/msdata/dmz-api-grpc:/msdata/dmz-api-grpc \
        -d dmz-test

here is mongodb:

docker run -d --name=mongodb-test \
	-p 27017:27017 \
	--restart=always \
    --network=e2e-test-network \
	-v /home/kai/work/root/tests/msdata/mongo-data:/data/db \

container#1 tries to connect to mongodb at mongodb-test:27018, but it is not working.
I would really appreciate any advice!