mvn package -Pdocker
for each repo will create the Docker image.
By default, the Docker image name is arungupta/<service>
where <service>
is greeting
, name
or webapp
.
Run this command in each directory which contains clones from github (microservices-greeting, microservices-name, microservices-webapp)
$ mvn package -Pdocker
The image can be created in your repo:
mvn package -Pdocker -Ddocker.repo=<repo>
By default, the latest
tag is used for the image. A different tag may be specified as:
mvn package -Pdocker -Ddocker.tag=<tag>
$ docker run -d -p 8081:8081 arungupta/greeting (close the previous session open with 8081) $ curl http://localhost:8081/resources/greeting
(Important) Attach AmazonEC2ContainerRegistryFullAccess Policy to k8s-workshop-LabIdeRole-xxx Role through AWS IAM console or using aws-cli.
Log in to ECR
$ aws ecr get-login --no-include-email --region us-west-2 or us-east-1 (copy and paste the output of this commend)
Create ECR repository to deploy docker into ECS.
$ aws ecr create-repository --repository-name greeting $ aws ecr create-repository --repository-name name $ aws ecr create-repository --repository-name webapp
Tag each docker image to push into ECR.
$ docker tag arungupta/greeting:latest <account id>.dkr.ecr.us-east-1.amazonaws.com/greeting:latest $ docker tag arungupta/name:latest <account id>.dkr.ecr.us-east-1.amazonaws.com/name:latest $ docker tag arungupta/webapp:latest <account id>.dkr.ecr.us-east-1.amazonaws.com/webapp:latest
Push each docker images to the registry:
$ docker push <account id>.dkr.ecr.us-east-1.amazonaws.com/greeting:latest $ docker push <account id>.dkr.ecr.us-east-1.amazonaws.com/name:latest $ docker push <account id>.dkr.ecr.us-east-1.amazonaws.com/webapp:latest
-
List containers:
docker container ls -f name=myapp*
-
Get logs for all the containers in the
webapp
service:docker service logs myapp_webapp-service
You are now ready to continue on with the workshop!