How to build and push Docker image without deploying?

Hi everyone,

I’m trying to build and push a docker image to the app fly registry without triggering a deployment, but I’m running into some issues.

This command completes but I don’t see the image in the registry:

fly deploy -c fly.workers.toml --build-only --push --image-label “dev”

Output:

→ Build Summary: () → Building image done image: ``registry.fly.io/workers:dev`` image size: 979 MB

This command works and I can see the image in the registry, but it also deploys:

fly deploy -c fly.workers.toml --push --image-label “dev”

Questions

  1. Is there a way to build and push without deploying?

  2. Am I using the wrong combination of flags with --build-only and --push?

  3. Should I be using a different approach entirely?

Any insights would be greatly appreciated! Thanks in advance for your help.

You have the right combination of flags. Apparently this isn’t working with depot (our default builder).

  • I opened a pull request to fix this
  • Meanwhile you can work around this problem by specifying –-depot=false.

GOATED! Thank you!

Hi, I didn’t have the chance to try it until now, but I can’t get it working with -–depot=false as well.

fly deploy -c fly.client.toml --build-only --push --depot=false --image-label=main
fly deploy -c fly.client.toml --build-only --push --depot=false --image-label main
fly deploy -c fly.client.toml --build-only --push --image-label main --depot=false

These don’t work for me. What am I doing wrong?

what exactly happens? do you get an error message? “doesn’t work” is not specific enough.

Obviously getting the same as in my initial post, otherwise I would have mentioned if there is a specific error.

→ Pushing image done
image: registry.fly.io/app-workers:dev
image size: 2.9 GB

that is different from your original post. it seems like it worked, are you able to use the image in machines?

I meant that I still can’t see it. My bad.

After these –depot=false commands, the image wasn’t created and I couldn’t see it anywhere.

When I added image = ‘registry.fly.io/app-workers:dev’ to the toml file and deployed, just then the image showed up in the registry.

Fine by me, all good. However is this the expected behavior?

that’s weird! I don’t think it’s expected behaviour. it seems to work for me without it:

lillian@tsukuyomi:~/src/test-app$ cat fly.toml 
app = "devplayground2"
http_service.internal_port = 8080
lillian@tsukuyomi:~/src/test-app$ fly deploy --local-only --build-only --push
[...]
--> Pushing image done
image: registry.fly.io/devplayground2:deployment-01K3J5E5EZRTRCECS6628BW3SD
image size: 192 MB
lillian@tsukuyomi:~/src/test-app$ fly m run --shell -a devplayground registry.fly.io/devplayground2:deployment-01K3J5E5EZRTRCECS6628BW3SD
Searching for image 'registry.fly.io/devplayground2:deployment-01K3J5E5EZRTRCECS6628BW3SD' remotely...
image found: img_8rlxp255dq8gp3jq
Image: registry.fly.io/devplayground2:deployment-01K3J5E5EZRTRCECS6628BW3SD@sha256:f0bd82c67d1005147ece4ed069861c0650297f7ec061d0246c5a54c212c4e08e
Image size: 73 MB

Success! A Machine has been successfully launched in app devplayground
 Machine ID: 080e470ae61928
Connecting to fdaa:3:752b:a7b:174:5345:8ea1:2... complete
root@080e470ae61928:/# echo $FLY_IMAGE_REF
registry.fly.io/devplayground2:deployment-01K3J5E5EZRTRCECS6628BW3SD@sha256:f0bd82c67d1005147ece4ed069861c0650297f7ec061d0246c5a54c212c4e08e

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.