konifay

From `Containerfile` via `podman` to `fly.io`

How to Deploy a Pre-Built Container to fly.io Using Podman


Preface

Many of my services are effectively Rust binaries with a shallow Containerfile. I oftentimes have the container image already ready to go locally and do not want to have an external build pass re-do the same work again. Consequently, I was looking for a way to deploy container images a while back and found fly.io, which served and serves the purpose well. A quick, updated document on how to do it.


Overview

This guide shows how to deploy a pre-built container to fly.io using Podman, bypassing Docker. It assumes you already have a container image with digest 7a7bb109 and an existing app named buxbunny.


Steps

1. Tag Your Local Image

Assign the image to the fly.io registry:

podman tag 7a7bb109 registry.fly.io/buxbunny:latest  

2. Create a Deploy Token and Log In

Generate a deploy token and use it to authenticate with Podman in one step:

flyctl tokens create deploy | podman login -u x --password-stdin registry.fly.io/buxbunny  

3. Push the Image

Upload the tagged image to the fly.io registry:

podman push registry.fly.io/buxbunny:latest  

4. Deploy Using fly.toml

Update fly.toml to use the pre-built image:

#..

[build]  
image = "registry.fly.io/buxbunny:latest"  

#..

Then deploy:

flyctl deploy --app buxbunny  

Key Notes

  • Ensure the registry URL and app name in fly.toml match your setup
  • No Dockerfile or build context is required when using the image field

Original source: https://community.fly.io/t/howto-use-podman-instead-of-docker-for-local-builds-and-uploading-container-images/542