Docker Example
Flightcontrol recommends using a custom Dockerfile for new services. A Dockerfile gives you direct control over the image and build process and can be used consistently across local development, CI, and Flightcontrol.
Below is an example flightcontrol.json file showing a Docker deployment that authenticates to the Docker Hub.
Important Note for Docker Images
Please note, while using custom docker images, you will get build errors related to Docker Hub unauthenticated pull limit toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: [https://www.docker.com/increase-rate-limit](https://www.docker.com/increase-rate-limit), there are couple of workarounds:
- Use AWS Elastic Container Registry (ECR) public images instead of using Docker Hub, ECR will support unlimited free pulls within AWS resources
- If you have a Docker hub account, you can use
DOCKER_USERNAMEandDOCKER_PASSWORDenvironment variables, and Flightcontrol will authenticate the pull request automatically for you.
Configuration as Code
There are two ways to configure your deployment with Flightcontrol - the dashboard and with a configuration file.
Below is an example of a configuration file for a Docker deployment. This flightcontrol.json file also shows how to use the Docker Hub username and password environment variables to avoid the Docker Hub pull rate limits.
{
"environments": [
{
"id": "production",
"name": "Production",
"region": "us-west-2",
"source": {
"branch": "main"
},
"services": [
{
"id": "my-webapp",
"name": "My Webapp",
"type": "web",
"target": {"type": "fargate"},
"buildType": "docker",
"ci": {
"type": "ec2"
},
"dockerfilePath": "Dockerfile",
"dockerContext": ".",
"cpu": 0.25,
"memory": 0.5,
"port": 8080,
"minInstances": 1,
"maxInstances": 1,
"envVariables": {
"DATABASE_URL": {
"fromService": {
"id": "db",
"value": "dbConnectionString"
}
},
"DOCKER_USERNAME": {
"fromParameterStore": "docker.hub.username"
},
"DOCKER_PASSWORD": {
"fromParameterStore": "docker.hub.password"
}
}
},
{
"id": "db",
"name": "Database",
"type": "rds",
"engine": "postgres",
"engineVersion": "12",
"instanceSize": "db.t4g.micro",
"storage": 20,
"private": false
}
]
}
]
}