Skip to content

Instantly share code, notes, and snippets.

@psenger
Last active August 21, 2023 01:32
Show Gist options
  • Select an option

  • Save psenger/869f1e325b518e33269f592b45ab1222 to your computer and use it in GitHub Desktop.

Select an option

Save psenger/869f1e325b518e33269f592b45ab1222 to your computer and use it in GitHub Desktop.
[With Docker, pull a specific image from local docker, and then push that to a remote registry] #Docker

To pull a specific Docker image from your local machine and then push it to a remote Docker registry, you can follow these steps:

  1. Pull the Image Locally: Open a terminal window and use the docker pull command to pull the specific image you want from your local machine. Replace local-image:tag with the name and tag of the image you want to pull.
docker pull local-image:tag
  1. Tag the Image: After pulling the image, you need to tag it with the address of your remote Docker registry. Replace remote-registry.com/your-repo/remote-image:tag with the appropriate registry, repository, and tag information.
docker tag local-image:tag remote-registry.com/your-repo/remote-image:tag
  1. Push the Image to the Remote Registry: Log in to your remote Docker registry using the docker login command, then use the docker push command to push the tagged image to the remote registry.
aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
docker login remote-registry.com
docker push remote-registry.com/your-repo/remote-image:tag

Remember to replace remote-registry.com with the actual URL of your remote registry and adjust the repository and image names as needed.

Please note that for the docker login command, you will need proper credentials to authenticate with the remote registry. Make sure you have the necessary permissions and credentials to perform these actions.

Also, keep in mind that this process involves transferring potentially large Docker images over the internet, so it might take some time depending on your network connection speed and image size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment