Check to make sure they’re both on the same network. They probably aren’t, and you’ll probably have to create your own network and add them both to it in the docker run commands.
You can tell by doing a docker network ls, find which network you think they are on, and do a docker network inspect of that network, it’ll show you which containers are attached to that network.
I’m not sure how you’re trying to connect, but you will probably have better luck connecting via the container-name, and not the IP.