Now that you can Use Containers with Flyctl (now with docs!), it’s time to take the next step—or rather, the first step on the next journey: Docker Compose compatibility.
Make no mistake: there are a number of things that Docker Compose can do that aren’t compatible with the Fly.io containers implementation, and vice versa. But the important thing is that the overlap between what the two can do is quite significant, and many of the differences can be mitigated.
Example motivations for this feature:
-
You have an existing application that runs with Docker Compose, and you want to deploy it to Fly.io.
-
You ran
fly launch
on a new application and it fails, and you want to debug it locally before trying again (divide and conquer). -
You have an application deployed to Fly.io and want the ability to test out new features locally before deploying changes.
A quick demo to demonstrate the possibilities. Start by running:
fly version upgrade
Make sure that you are running v0.3.149
or later. Then, in an empty directory, run:
fly launch --from=https://github.com/fly-apps/rate-limiter-demo.git --ha=false
This will create an app that dumps out HTTP headers—nothing fancy.
Now edit the fly.toml
and add:
[build]
compose = 'compose.yml'
Then change the internal port so that traffic is routed to the nginx
container:
internal_port = 8080
Run fly deploy
and refresh your browser rapidly. You will soon see:
503 Service Temporarily Unavailable
All without modifying a single line of your application. All that is required is a compose.yml
and nginx.conf
file, and you now have a two-container application that you can build and deploy.
This is just the beginning—there is much more work to be done. I would like that work to be based on real-world use cases, so let us know what you would like to see supported!