Before starting, please ensure you have completed all the steps within Configuring your Environment. This will ensure that your dependencies have been installed, your AWS CLI has been configured and you are able to connect to your specific ECR workspace
Important Notes before continuing:
- For both methods below, the variable myapplication is the name you are assigning your container. It can be whatever you choose to make it, but it must be unique to each container that is pushed to your ECR. We recommend adding some kind of versioning to your container name.
- Your workgroup_repository_name can be found within your user profile. Please refer to How can I find my ECR Workgroup Repository Name?
Build & Push Example: Using the Rhino Util docker-push.sh
The docker-push.sh script can be found in the user-resources GitHub repository under the rhino_utils folder. Using a terminal or command line navigate to the directory where your Dockerfile and other relevant files are found. Copy the docker-push.sh script into that folder and make it executable by running
chmod +x docker-push.sh
cd to the directory where your Dockerfile and other relevant code files are found.
./docker-push.sh <workgroup_repository_name> myapplication
Build & Push Example: Using just Docker
cd to the directory where your Dockerfile and other relevant files are found.
Build Container Command
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -t 913123821419.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>:myapplication .
Note: the period at the end of the above build command.
Push Container Command
docker push 913123821419.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>:myapplication
List Local Images Example
> docker images 913123821419.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>
List Remote Images Example
> aws ecr list-images --registry-id 913123821419 --repository-name <workgroup_repository_name>
Pull a Container Image from a Remote Repository
> docker pull 913123821419.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>:myapplication