What you do is expose the port on the host, then you can easily connect to it from any container.
The “expose” section in the yml takes care of it:
expose:
- "5432:5432"
- "6379:6379"
- "2221:22"
Then all you need to do is plug in local machine ip here: