Photo by Martin Vorel

Docker published ports

December 14, 2023 Reading time: ~1 minute DevOps

💡 Be careful when publishing your docker container ports

⚠️ Docker creates iptables rules that can expose your containers to the entire Internet!

✅ Make sure to always bind locally like the example below. By doing this, the container will only be accessed by the host.

docker run -p 127.0.0.1:8080:80 nginx

Find out more in the Docker documentation.