failed to fetch an image or build from source: Authentication required to access image

Tried to build and deploy a new version of my app today and got

fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Searching for image 'andig/private-repo' remotely...
Error: failed to fetch an image or build from source: Authentication required to access image "docker.io/andig/private-repo:latest"

At the same time
docker login -u andig works fine on that machine, so does fly auth docker.

This flow used to work. Has something changed for private repos? Can I still work with them?

Thanks,
Andi

Got it: bisect shows this has been broken in flyctl v0.0.354. Opened issue v0.0.354: failed to fetch an image or build from source: Authentication required to access image · Issue #1100 · superfly/flyctl · GitHub.

Can you try with fly deploy --local-only? Remote builders don’t support private repos, so it’s likely you were deploying using your local Docker, which was the default before this change.

1 Like

I can do that- it just came as a surprise. It’s not immediately clear to my why I even need a remote builder since all I’m asking for is to deploy the image that has already been built.

Update: from the docs:

Finally, if you already have a Docker image in a repository and just want to deploy that, you can skip the building process and go straight to the deploy with the image build option.

Since I already use the image option I wouldn’t expect any (remote) builders to be involved at all.

1 Like

That is a good point @andig. The default behavior was changed because many users had problems with their local docker setups and in most cases the image built locally was for a different architecture than what Fly.io can use. By using a remote builder (by default) the incompatibility is not a problem anymore and remote builder has been reliable for a long time now.

1 Like

Thank you, resolved for me.

1 Like

I have a follow-up problem now at Cannot deploy docker app: Could not find image. Again not using builder but deploying ready-built docker container.

Is this still not supported? I’m trying to deploy a container image from a public gitlab container repo and flyctl seems to think that authentication is required. Switching to a local or remote builder isn’t an option for me. Thanks

Hi @tvaughan

Deploying from public registries should work. Can you share your fly.toml, please?

Hi @pavel, Thanks for your response.

I simply ran flyctl launch -i registry.gitlab.com/tvaughan/datopro-mic:1.0.6726. This is with the latest flyctl on macOS installed by brew. FYI - The ports and protocols are wrong. This is not a web service. Container registry is https://gitlab.com/tvaughan/datopro-mic/container_registry/4153765. I was able to pull this image from a brand new virtual machine that never had my gitlab credentials.

app = "frosty-snow-9746"
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "scl"
processes = []

[build]
  image = "registry.gitlab.com/tvaughan/datopro-mic:1.0.6726"

[env]

[experimental]
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  min_machines_running = 0
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

Error message is:

$ flyctl deploy
==> Verifying app config
--> Verified app config
==> Building image
Searching for image 'registry.gitlab.com/tvaughan/datopro-mic:1.0.6726' remotely...
Error: failed to fetch an image or build from source: Authentication required to access image "registry.gitlab.com/tvaughan/datopro-mic:1.0.6726"