Skip to content

Firewall Rules for Process Isolated Containers Don't Work as Expected #561

@sikhness

Description

@sikhness

Describe the bug
When building an image in docker with exposed ports, and you run a process isolated container from that image with that exposed port mapped to something else, defining a Windows Firewall rule does not work on the mapped port, instead you have to define it on the port you exposed in the image which is odd.

For example, if you define EXPOSE 9443 in a Dockerfile during the build of an image, and then run a container using this image and map the port to something else like -p 9081:9443, you would expect that your firewall rules would need to be defined on port 9081 since that is the one exposed to the host. However, you instead need to define it on 9443 for it to take effect.

This is an issue because if you use the same image or other images with the same internal ports, despite you mapping them to different individual host ports when running containers made from them, all containers using that image will have the firewall rule applied to it regardless of which port you have it mapped to.

To Reproduce

  1. Create a Dockerfile and expose a port using something like EXPOSE 9443
  2. Run a process isolated container with the internal port exposed to something else using something like -p 9081:9443
  3. Create a block all firewall rule on 9081 and you'll see that nothing happens, the service is still accessible as normal.
  4. Change the block all firewall rule to 9443 and you'll now see the service is no longer reachable on 9081

Expected behavior
The expected behaviour should be that creating a block all firewall rule on the mapped port (9081 in this example) would block the service on 9081, but instead it does nothing.

Configuration:

  • Edition: Windows Server 2025
  • Base Image being used: Windows Server Nano 2025
  • Container engine: Docker
  • Container Engine Version: 27.3.1

Metadata

Metadata

Assignees

Labels

NetworkingConnectivity and network infrastructure🚀 LTSC 2025Windows container images 2025

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions