See companion blog & explanation here: https://medium.com/@valgaze/from-zero-to-private-docker-registry-b42abad46fef
Requirements:
-
Docker
-
AWS acccount + resource permissions to use AWS Elastic Container Registry (ECR)
Run the following from the root of this repo, if you don't have npm/node available see "scripts" section of root package.json, destroy container & image with npm run killall
docker build -t namegame .
Set up CLI tool (if not already configured you'll need secret access keys and region of your registry, hit ENTER to accept defaults)
aws configure
aws ecr create-repository --repository-name namegame
Authenticate to the docker registry (replace <>'s with the registry's region, copy the output of this first command into your terminal
aws ecr get-login --no-include-email --region <your-region-here>
#ex. $ aws ecr get-login --no-include-email --region us-west-1
Tag your image with remote registry URI (replace <>'s below with your account id and the registry's region from previous step)
docker tag namegame:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com/namegame
#ex. docker tag namegame:latest 0123456789.dkr.ecr.us-east-1.amazonaws.com/namegame
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/namegame:latest
docker rmi namegame # Now no longer on our machine, we'll need to fetch from remote registry
docker create --name namegame_container -p 8000:8000 <aws_account_id>.dkr.ecr.<region>.amazonaws.com/namegame:latest
docker start namegame_container # should be available on port 8000
aws ecr delete-repository --repository-name namegame --force