Separation of 2 docker containers running the same web application

I have created an image that runs an instance of mongodb and a web server. It only exposes the port 8000 (for the web interface).
The web server is a nodejs applications (sails.js) that connect to the mongodb instance local to the container.

I then run 2 containers (on the same machine) with this image:

sudo docker run -P test/server

The first container has the port 8000 mapped to 49169, and the second one has the port 8000 mapped to 49170.

Then I open et browser on the first server (49169) and login.

The thing is, when I open a browser to the second server (49170) I do not need to login as if I was using the first server. Are those 2 containers (exposing the same port) are really isolated ? Should I use a different port for each one (even if Docker maps the port 8000 to 2 different port on the host) ?

UPDATE

the problem is not resolved yet but it seems the 2 containers use the same mongo db instance. I do not understand as I use an image of mongo to build the image of my application

What framework is the web server using? If you're using e.g. Django, and the app is connected to the same database, you will be seen as already logged in (as your session resides in the DB).

Yes, the two containers will run in isolation. Docker run will start these containers with different primary processes. The only common thing you have here is that they run on the same port inside the container, however mapping them on different ports in the host machine makes both the application accessible directly from the host.