Single-container Docker
- Single Docker container per EC2 instance
- Run from Dockerfile or Dockerrun.aws.json
- can be bundled with source code and deployed as .zip
Multi-container Docker
- Multiple Docker containers per EC2 instance
- Uses ECS underneath
- ECS Cluster
- ECS Task Definition = Dockerrun.aws.json
- ECS Task
- Run on every container instance in the environment
- ECS Data Volumes
- EB Creates log volumes
- Does not support Dockerfile
- image must be built and uploaded to Docker repo
- Application is deployed on the container instance and mounted to the container
Preconfigured Containers
- Single container docker
- Based on stacks officially supported by Docker Official Repositories
- Cannot use configuration files to customize
- Can use Dockerfile
Dockerrun.aws.json (version 1)
- Used by single-container deployments
- Describes how to run Docker container on EB
- Overlaps with Dockerfile (can be used instead of it)
- Structure
- AWSEBDockerrunVersion
- 1
- Authentication
- Bucket/Key to the authentication configuration file (see below)
- Image (see FROM)
- Ports (see EXPOSED)
- Volumes
- EC2 host volumes mapped to container (hostDirectory->containerDirectory)
- Logging
- Folder where application keeps logs
- EB uploads the logs to S3 when "tail" or "bundle" requested
- If you move to /rotated they will get uploaded as well
- AWSEBDockerrunVersion
Dockerrun.aws.json (version 2)
- Used by multi-container deployments
- Structure
- AWSEBDockerrunVersion
- 2
- Authentication
- Same as 1
- Volumes
- mount points
- allow container to "see" the folder
- source code is deployed to container instance (/var/app/current)
- EB configures additional volume for logs
- one for each container
- /var/log/containers/$containername
- ContainerDefinitions (uses ECS Task format)
- Name
- Image
- Same as 1
- Environment
- Environmental variables
- Essential
- Should the ECS Task stop if the container fails
- Memory
- Quota
- Mount Points
- Volumes from the container instance to mount
- References Volumes section
- Volumes from the container instance to mount
- PortMappings
- hostPort -> containerPort
- Links
- Containers to link
- AWSEBDockerrunVersion
Docker Authentication configuration file
- Login details for the Docker repo
- Stored in S3
- Referenced by Dockerrun.aws.json
- Read by EB to pull a Docker container from private repo
No comments:
Post a Comment