Created
October 12, 2022 15:31
-
-
Save VishDev12/0a87ba39a80f7ec0949e3121036e463b to your computer and use it in GitHub Desktop.
Uses Docker to pull an Image to the machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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