I have a couple of apps that I’m deploying on fly.io. Service A relies on Service B. I want devs working on Service A to have the latest production version of Service B available to develop against. In the past it’s been easy with a docker-compose setup. Docker-compose grabs both images, runs both services, and A can hit B’s api easily.
The first thing I tried with a fly.io deployment was to build a Service B image locally and push it to a private registry on ghcr.io. My thinking was docker-compose and fly.io could each grab the :latest
image and the devs would be using whatever was live in prod. That works fine for devs on their docker-compose setup, but that didn’t work on fly.io because fly.io can’t authenticate to pull a private image from ghcr.io. (as far as I can tell)
My second attempt is to use the standard easy fly.io deployment setup, which should build an image and store it in a private fly.io registry. That works for fly.io, but I can’t figure out what URI to use in docker-compose so devs can use the same image locally. Is that possible, or are images in the registry.fly.io not available outside the fly bubble?
Any other thoughts on how to accomplish this would be appreciated.
I don’t know if a regular fly deploy
results in an easy-to-reuse image, but you can pretty easily use regular Docker to build an image and store it on fly.io registry. I create a separate “app” for container images
docker build --push -t http://registry.fly.io/<myorg>-containers:appB .
Then in a Dockerfile:
FROM registry.fly.io/myorg-containers:appB
And use fly auth docker to auth with registry
Thanks for the response!
I think what you’re saying is that if I build the image outside of the fly deployment process, and push it to the fly registry, then it will be accessible to devs locally.
How did you create a separate “app” for container images? When I try to push to the http://registry.fly.io I get the error
name unknown: app repository not found
Also, is there any documentation on this topic?
I figured this out by using fly releases --image
to get the full descriptor of the existing repository.
“fly apps create”, then just never deploy to it. I use it for more base image type use cases, so slight different than your use case if reusing the actual app image
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.