Private docker image or cross-app pull

You can pull images from other apps in your account. I have a separate containers app and use that in my other apps. Here’s script I use to build/push images locally (on M1 mac, so has some extra stuff to build for amd64). You’ll need to run flyctl auth docker if you haven’t.

VERSION=1.1
IMAGE=registry.fly.io/<YOUR-NAME>-containers:my-app$VERSION
BUILDER=image_builder
echo "Building $IMAGE"
docker buildx use $BUILDER || docker buildx create --use --name $BUILDER
DOCKER_BUILD_KIT=1 DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform linux/amd64 --push -t $IMAGE .
docker buildx stop

Then in your Dockerfile:

FROM registry.fly.io/<YOUR-NAME>-containers:my-app1.1

Similar thread here

1 Like