It's possible to edit or create files on the remote docker environment with an ssh command.
In this example we are creating a daemon.json file in /etc/docker with configuration to use a registry-mirror. Then we execute sudo service docker restart on the remote environment to restart the docker daemon, which will pick up the new configuration. Then docker system info executes in the primary container, and will report the successful configuration of docker.
- image: circleci/python:3
cat \<< EOF | ssh remote-docker "sudo tee -a /etc/docker/daemon.json"
ssh remote-docker "sudo service docker restart"
docker system info
Note: The -a in the tee command will append to a file if it exists, or create the file if it does not exist.
This strategy can be used for other services that need to be configured in the remote environment as well.