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.
Make sure that the docker daemon has been started as a prerequisite to pushing containers to the ECR.
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. Read Viewing Container and Artifact Settings in the Viewing Your Account, SFTP, Container and Artifact Settings page for more details.
Production Environment URIs
For users in our production environments pushing container images to their workgroup's repo on Rhino FCP, here are the URIs they need to use for AWS and GCP.
AWS
In environments using a Rhino Orchestrator on AWS (currently dashboard.rhinohealth.com):
{AWS_ACCOUNT_ID}.dkr.ecr.{AWS_REGION}.<http://amazonaws.com/{WORKGROUP_REPO_NAME}:
{TAG}|amazonaws.com/{WORKGROUP_REPO_NAME}:{TAG}> GCP
In environments using a Rhino Orchestrator on GCP (currently dashboard.rhinofcp.com):
{GCP_REGION}-<http://docker.pkg.dev/{GCP_PROJECT_ID}/{WORKGROUP_REPO_NAME}/images:
{TAG}|docker.pkg.dev/{GCP_PROJECT_ID}/{WORKGROUP_REPO_NAME}/images:{TAG}> About Variables
Here are some details about the variables in the above templates:
AWS_ACCOUNT_ID: Our production AWS account ID:
865551847959AWS_REGION: Our production AWS resources are in:
us-east-1GCP_REGION: Our production GCP resources are in:
europe-west4GCP_PROJECT_ID: Our production GCP project ID:
rhino-health-prodWORKGROUP_REPO_NAME: Configured for each workgroup in our database, and available for users in our dashboard under "Settings" -> "Containers & Artifacts".
TAG: Arbitrarily chosen by users to label each container image. Unique in each workgroup's repo, and immutable, i.e. after pushing one container image with a given tag, no other may be pushed with that tag.
Examples
The following examples show how to build and push containers, and also list and pull images.
Build and 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 and Push Example: Using Only 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 865551847959.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 865551847959.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>:myapplication
List Local Images Example
> docker images 865551847959.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>
List Remote Images Example
> aws ecr list-images --registry-id 865551847959 --repository-name <workgroup_repository_name>
Pull a Container Image from a Remote Repository Example
> docker pull 865551847959.dkr.ecr.us-east-1.amazonaws.com/<workgroup_repository_name>:myapplication