Networking from remote-docker to primary container

We have a job that creates a docker container on a remote-docker instance. That container needs to communicate with a process running on the job’s primary container. Is this possible?

You can use port forwarding through ssh:
ssh -f -N -L 127.0.0.1:8000:127.0.0.1:8000 remote-docker

If you want to start and stop it in the build so it runs in the background you can use the following scripts (assuming your port is 5432)
ssh -fNT -L 127.0.0.1:5432:127.0.0.1:5432 -S /tmp/.remote-docker -M remote-docker # start
ssh -S /tmp/.remote-docker -O exit remote-docker # stop