Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push a tar archive to private docker registry?

Now I have such a requirement,firstly I need export a container’s filesystem as a tar archive, then I need push this tar to my own docker registry.So could I push a tar file which is exported by using docker export image_name to my private registry.Before this I only know I could push a local image to registry by using docker push image_name. Thanks!

like image 885
fighter Avatar asked Sep 26 '18 15:09

fighter


People also ask

How do I push to private registry docker?

log into your docker hub account, and go to your global settings. There is a setting that allows you to set what your default visability is for the repositories that you push. By default it is set to public, but if you change it to private, all of your repositories that you push will be marked as private by default.

How do I push an image to private Docker Hub?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

What command will allow you to save a docker image as a tar archive?

The docker export - Export a container's filesystem as a tar archive. The docker import - Import the contents from a tarball to create a filesystem image. The docker save - Save one or more images to a tar archive (streamed to STDOUT by default)


2 Answers

If you don't want to use any external tools, you can use a combination of:

docker image load --input image.tar.gz # this will output the original image name
docker image tag original-registry.example.org/original-image-name:0.0.1 new-registry.example.com/new-image-name:0.0.1
docker push new-registry.example.com/new-image-name
like image 173
Falko Menge Avatar answered Oct 25 '22 23:10

Falko Menge


The crane tool seems to have this functionality:

crane pull - Pull a remote image by reference and store its contents in a tarball
crane push - Push image contents as a tarball to a remote registry
like image 41
paleozogt Avatar answered Oct 25 '22 22:10

paleozogt