Two same containers working connected to each other

Hello,
I want to make two container with same .net core app, when one is down (or when gives error in application) , I want to make the other same container with different port up. I really dont know how to do that. can someone show me a way please?