#TIL : Becareful on using port mapping of Docker in Development

17 Mar 2022 / by KhanhIceTea

Many examples, articles and repository use insecure config in port mapping Docker.

This is example in official document of Docker


$ docker run -d -p 80:80 my_image nginx -g 'daemon off;'


from 12.2k stars repo in Github


      - '5432:5432'

This mapping config means you will proxy all traffic from the container port to the docker host (your dev machine) with binding It means if you don't have a firewall or accidently open all ports, your contaier data will be public in the Local Network (so danger if you use in public places like coffee shops)

So remember to add the IP, which you wanted to bind in docker host (or have a network firewall ON)

      - ''
      - ''

Sound good ?