Skip to content

Latest commit

 

History

History
109 lines (81 loc) · 3.81 KB

File metadata and controls

109 lines (81 loc) · 3.81 KB

Running Java EE in a Docker container on EC2 Container Service (ECS)

Stack:

Provisioning AWS infrastructure

alt text

Docker Registry

This demo will use AWS ECR for ease to use and simple integration with AWS ECS. Private docker registries are also support, check the References section for more information.

  • Configure the repository:

alt text

  • One the repository is created, ECR will provide the steps on how to login to the docker registry, tag and push an image. Follow the steps.

alt text

FROM payara/server-full

COPY cargo-tracker.war /opt/payara41/glassfish/domains/domain1/autodeploy

CMD $PAYARA_PATH/bin/asadmin start-domain --verbose
  • Example pushing the docker image:
docker push 541485779343.dkr.ecr.us-west-2.amazonaws.com/cargotracker:latest
The push refers to a repository [541485779343.dkr.ecr.us-west-2.amazonaws.com/cargotracker]
a97cb8747e53: Pushed
391ac9396adc: Pushed
cc5861fb798c: Pushed
fa9fb17dcb0f: Pushed
c42bce907016: Pushed
3b80ea7ca789: Pushed
c98badc633ac: Pushed
3985bc20a806: Pushed
9640ba08218e: Pushed
3d2c411334a9: Pushed
bd9db2a15c4a: Pushed
a07cd0e5de92: Pushed
cecc20f349f8: Pushed
c9e908787496: Pushed
c7ff02c44ca2: Pushed
555f98a2316c: Pushed
b0220a5743fa: Pushed
995042ba10ad: Pushed
fe40be59465f: Pushed
cf4ecb492384: Pushed
latest: digest: sha256:13ab8a42bf6ad7b21976c2652b56a00d93c5da8715de8c96126352339a841c2a size: 4515
  • Create a Task Definition or in another words, the instructions on how the Docker container should run:

alt text

  • Configure the Service:

alt text

  • Configure the ECS Cluster:

alt text

  • Click on Review & launch, validate the setup and proceed by clicking on Launch instance & run service.

alt text

At the end of the setup, the following AWS resources will be provisioned:

  • ECS Cluster
  • Task Definition
  • ECS Instances
  • ECS Service
  • CloudFormation
  • Internet Gateway
  • VPC
  • Route table
  • 2 Subnets
  • Public routing
  • Security Group
  • Auto Scaling Group
  • Launch Configuration

References