I have a couple machines running in an isolated environment. They can be accessed via a bastion machine which has a public IP address. I'm currently trying to automate the distribution of docker images created in local machine to machines in the isolated environment.

Currently I have the following command:

docker save test/myapp  |  gzip  | pv | ssh ubuntu@bastion "cat > remote"

This command copies a file to the bastion machine. The problem is that I don't want anything to be saved in the bastion machine drive.

I want to write a script in the bastion machine that delivers the image to all machines in an isolated environment that don't have public IP address.

I think that I should have some kind of a script in bastion machine that would take input from a pipe.

The script should make an ssh command to each machine and run docker in a load image command. This would be easy to do with a docker machine but I can't use it because it requires Internet connection. Any ideas?

In short: I want to deliver a docker image from local machine to multiple servers via the bastion server.

I am pretty new in this kind of scripting so I'm sorry if my question is trivial but thus far I haven't been able to solve it.


It is possible to use multiple ssh pipes like this:

docker save testi/myapp  | gzip  | pv | ssh ubuntu@bastion "cat | pv | ssh ubuntu@host \"docker load\" "

This command loads the file to host machine through bastion and file isn't saved in bastion machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.