1. Pulling the Image from Docker Registry
Start by pulling the image from your Amazon ECR registry with the tag v1.0.0
.
Command:
docker pull 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:v1.0.0
2. Attaching to the Image
Create and start a container from the image and attach to it with an interactive terminal.
Command:
docker run -it 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:v1.0.0 /bin/bash
3. Making Changes Inside the Container
After attaching to the container, make any necessary changes. Once done, exit the terminal by typing:
Command:
apt update && apt upgrade -yq && \
apt install -yq \
gcc \
wget \
htop \
python3-pip
exit
4. Committing Changes
After making changes inside the container, commit those changes to a new Docker image.
Command:
docker commit <container_id> 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:v1.0.1
5. Tagging the New Image
Since the new image is already correctly tagged in this example, this step can be considered complete with the previous commit
command. However, if you needed to tag the image differently, you would use:
Command:
docker tag 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:v1.0.1 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:another-tag
6. Pushing to Registry
Push your newly tagged image to the Amazon ECR registry.
Command:
docker push 12345689.dkr.ecr.us-east-1.amazonaws.com/asr-docker:v1.0.1
7. Cleanup
Finally, clean up unused Docker resources to free up space.
Commands:
docker system prune
docker image prune
'ML Engineering > Docker' 카테고리의 다른 글
Maximizing Docker Efficiency: Techniques for Reducing Image Size and Build Time (0) | 2024.08.09 |
---|