Upgrading mongo locally using docker not working

I am trying to update the mongo version for my local machine. I noticed that when I update the image from version (from 3.4 to 3.6) then although the mongo image starts, no clients (my app and studio3T) can connect to the new image (get connection timeouts).

Another method I tried is creating two new clean containers (one version 3.4 and the other 3.6) and getting a dump from 3.4 and copying it to the 3.6 container and doing a restore. The restore worked however when I tried to connect to the 3.6 database using studio3T, I got a connection issue again.

My dump contained one small document.

I am quite lost. How come something so simple isn’t possible?

I had to add --bind_ip_all when starting the container.

So I changed my docker-compose.yml file to (Added the command: ):

mongo-new:
  image: mongo:3.6
  ports:
    - 27021:27017
  volumes:
    - mongo-test-new:/data/db
  command: --bind_ip_all

This was a change in version 3.6 [ref]