Skip to content

Instantly share code, notes, and snippets.

@VishDev12
Created October 12, 2022 15:31
Show Gist options
  • Select an option

  • Save VishDev12/0a87ba39a80f7ec0949e3121036e463b to your computer and use it in GitHub Desktop.

Select an option

Save VishDev12/0a87ba39a80f7ec0949e3121036e463b to your computer and use it in GitHub Desktop.
Uses Docker to pull an Image to the machine.
# Install the ECR Credential Helper that automatically authenticates with ECR.
sudo yum install amazon-ecr-credential-helper -y
# Configure Docker to use the credential helper.
mkdir ~/.docker/
cat > ~/.docker/config.json << EOF
{
"credsStore": "ecr-login"
}
EOF
# Docker is not started when the machine is booted, so start it.
sudo service docker start
# Pull the Image with docker.
# Since sudo is used, explicitly specify the location of the Docker config file.
sudo docker --config /home/ec2-user/.docker pull $IMAGE
# Verify the presence of the Image on the machine.
sudo docker image ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment