Publishing to a Registry
# authenticate (default registry is https://index.docker.io/v1/)
docker login
docker login <registry-host>
# tag the local image with your namespace
docker tag <local-image>:<tag> <username>/<repository>:<tag>
# push
docker push <username>/<repository>:<tag>
docker logout
Find the image ID to tag with docker images. If a push is rejected on authentication, run
docker login and retry. Docker Hub's free tier allows one private repository and unlimited
public ones.
Moving images without a registry
docker save -o backup_container.tar <image>:<tag> # export image to a tar file
docker load -i backup_container.tar # import it elsewhere
docker export <container> > container.tar # export a container filesystem
docker import container.tar <image-name>:<tag>
save and load work on images and preserve layers and tags. export and import flatten a
container's filesystem and discard history — use save/load unless you specifically want the
flattening.