Check out example codes for "docker run port mapping". It will help you in understanding the concepts better.

Code Example 1

Use this command to see the port mapping:
docker ps

Code Example 2

$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash

Code Example 3

sudo docker exec -it <container name> <command>

Learn ReactJs, React Native from akashmittal.com