Getting Recv failure: Connection reset by peer when CURLing a Container from an external network

Hello!

Having a bit of a bamboozling issue with Docker and networking.

The architecture is set up so there are multiple instances running Docker Community 20.10.12 (both Client and Server) on top of CentOS8, with the CentOS instances segmented into different VLans.

When attempting to curl a container running on one instance from another instance within the same Vlan, the request goes through as expected.

However, when attempting to curl the same instance from another instance in a different Vlan, I keep getting curl: (56) Recv failure: Connection reset by peer.

The part that makes it strange is I have narrowed down that the issue is not related to networking or firewall setup.

  • The target instance can be pinged successfully from another VLAN.
  • Running a non containerized application on the target instance is accessible on the target port from another VLAN as expected.
  • This issue has also been tested across different containers, so it is not limited to the specific one I’m trying to access (Keycloak for reference).

It is also worth noting the container has been correctly mapped to 0.0.0.0 and is also accessible from the target port locally. Firewalld has also been configured with the appropriate rules to allow external access to the target ports as desired.

I just can’t for the life of me figure out what the issue is.

Any suggestions or assistance would be greatly appreciated!!!