Docker Community Forums

Share and learn in the Docker community.

Transfer an image from localhost to my swarm's registry


(Atemiz) #1

Hi,
How can I transfer an image from localhost to my swarm’s registry ?
Regards


(Arul Selvan) #2

Tag your image as shown below (replace with correct image id and name, version etc)

docker tag <your_image_id> your.dockerregistry.com/yourimage:version

After creating the tag, do a push as shown below

docker push your.dockerregistry.com/yourimage:version


(Garylonbrown) #3

Also, if authentication is required, you will need to login “before” the push:

docker login -u -p <your.dockerregistry>.com


(Tgeliot) #4

I just want to add that after doing the “docker tag” operation, if you did a “docker images” to view your images in your local cache (aka “local registry”), you’d see an entry that looks like
your.dockerregistry.com/yourimage:version
This can be confusing, because it sure looks like your image is in the shared registry. But it isn’t yet. The “docker push” command that Arul gave is necessary to get the image actually moved out to the shared registry; the push operation determines the destination registry by looking at the URL you put in the image’s tag.

I find this business of embedding the registry’s URL in the images name weird. I guess there must be a good reason for it, but it always make me feel a little off balance.