Skip to content

Private Container Registry (_CR)

Prayag edited this page Sep 11, 2023 · 8 revisions
  • setup ~/.docker/daemon.js
{
  "registry-mirrors": ["https://artifactory.lamatola.com"]
}

Login

## build.sh 
## build and tag
export PROFILE_DEV=dev
export PROFILE_PROD=dev

export ACCOUNT_ID_DEV=12345678
export ACCOUNT_ID_PROD=12345678

aws ecr get-login --no-include-email --profile $PROFILE_DEV --region us-east-1
docker login -u AWS -p <<password>>  https://${ACCOUNT_ID_DEV}.dkr.ecr.us-east-1.amazonaws.com

Pull image

## public example
docker pull artifactory.lamatola.com/dockerhub-remote/openjdk:11

Push a container image

## build.sh 
## build and tag
export PROFILE_DEV=dev
export PROFILE_PROD=dev

export ACCOUNT_ID_DEV=12345678
export ACCOUNT_ID_PROD=12345678

export SERVICE_REPO=retailstore-rest
export LOCAL_SERVICE_VERSION=latest
export REMOTE_SERVICE_VERSION_DEV=1.0.90-DEV
export REMOTE_SERVICE_VERSION_PROD=1.0.81

docker build -t ${SERVICE_REPO}:${LOCAL_SERVICE_VERSION} .
docker tag ${SERVICE_REPO}:${LOCAL_SERVICE_VERSION_DEV} ${ACCOUNT_ID_DEV}.dkr.ecr.us-east-1.amazonaws.com/${SERVICE_REPO}:${REMOTE_SERVICE_VERSION_DEV}
aws ecr get-login-password --region us-east-1 --profile ${PROFILE_DEV} | docker login --username AWS --password-stdin ${ACCOUNT_ID_DEV}.dkr.ecr.us-east-1.amazonaws.com

docker push ${ACCOUNT_ID_DEV}.dkr.ecr.us-east-1.amazonaws.com/${SERVICE_REPO}:${REMOTE_SERVICE_VERSION_DEV}
Clone this wiki locally