Docker is a popular tool to containerize and share images. Recently we ported a POS system into a docker image and had to share it with a client before we setup a private registry. This is how we share the image from my dev machine to clients local server.

Dev Machine: Kubuntu, 22.04

1
docker save pos_web:latest | gzip > pos_web.tar.gz

You can export it to a regular tar file using the following command. Gzip just make the file smaller.

1
docker save -o pos_web.tar save pos_web:latest

You can then transfer the file to the client server. If you have ssh access to the server you can do so using a simple SCP command.

1
scp ./path/to/pos_web.tar.gz user@server:~/

The above command will transfer the file to the home folder.

Once the file is in the server you can load the image using the docker load command.

1
docker load < ./pos_web.tar.gz

This command will load an image or repository from a tar archive (even if compressed with gzip, bzip2, or xz) from a file or STDIN. It restores both images and tags. Source: https://docs.docker.com/engine/reference/commandline/load/

So no need to decompress before loading.

PS: Found this gem from the stackoverflow

Run all the above in a single command.

1
docker save <image> | bzip2 | ssh user@host docker load

or to see with progress bar

1
docker save <image> | bzip2 | pv | ssh user@host docker load

Source: https://stackoverflow.com/a/26226261/1749638