Error deploying rails app - failed to fetch an image or build from source: error building: failed to solve

Hi,

My deploy was working well but last night started to fail. Any hints?

✓ Configuration is valid
--> Verified app config
==> Building image
Remote builder fly-builder-misty-sun-7435 ready
Remote builder fly-builder-misty-sun-7435 ready
==> Building image with Docker
--> docker host: 24.0.7 linux x86_64
[+] Building 1.7s (14/22)
 => [internal] load .dockerignore                                                                                                                                           0.2s
 => => transferring context: 756B                                                                                                                                           0.2s
 => [internal] load build definition from Dockerfile                                                                                                                        0.2s
 => => transferring dockerfile: 2.58kB                                                                                                                                      0.2s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                                                  0.8s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:dbbd5e059e8a07ff7ea6233b213b36aa516b4c53c645f1817a4dd18b83cbea56                                             0.0s
 => [internal] load metadata for docker.io/library/ruby:3.2.2-slim                                                                                                          0.3s
 => [internal] load build context                                                                                                                                           0.2s
 => => transferring context: 31.89kB                                                                                                                                        0.2s
 => [base 1/3] FROM docker.io/library/ruby:3.2.2-slim@sha256:b1b1636eb4e9d3499fc6166f54f7bb96d792e005b887091346fd1ae01ad97229                                               0.0s
 => CACHED [base 2/3] WORKDIR /rails                                                                                                                                        0.0s
 => CACHED [base 3/3] RUN gem update --system --no-document &&     gem install -N bundler                                                                                   0.0s
 => CACHED [build 1/9] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y build-essential curl libpq-dev node-gyp pkg-config python-is-python3        0.0s
 => CACHED [build 2/9] RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ &&     /tmp/node-build-master/bin/node-build "18.16.0" /u  0.0s
 => CACHED [build 3/9] COPY --link Gemfile Gemfile.lock ./                                                                                                                  0.0s
 => CACHED [build 4/9] RUN bundle install &&     bundle exec bootsnap precompile --gemfile &&     rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/  0.0s
 => ERROR [build 5/9] COPY --link package.json package-lock.json yarn.lock ./                                                                                               0.0s
------
 > [build 5/9] COPY --link package.json package-lock.json yarn.lock ./:
------
Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref f7de9bd4-0138-4474-9cae-f6fbdab1172e::nyipwx1yvethbamytxmn7yl3f: "/package-lock.json": not found```

I ran the fly doctor command and the result was: 

Testing authentication token… PASSED
Testing flyctl agent… PASSED
Testing local Docker instance… Nope
Pinging WireGuard gateway (give us a sec)… PASSED
Testing WireGuard DNS… PASSED
Testing WireGuard Flaps… PASSED

App specific checks for rush-advantage:
Checking that app has ip addresses allocated… PASSED
Checking A record for rush-advantage.fly.dev… PASSED
Checking AAAA record for rush-advantage.fly.dev… PASSED

Build checks for rush-advantage:
Checking docker context size (this may take little bit)… PASSED (5.0 MB)
Checking for .dockerignore… PASSED


Thanks!

I’m pretty sure there’s some kind of network issue which makes connections to internet extremely slow an thus, timeouts are present

You think this might be on Fly.io’s side? Because My internet connection doesnt show any issues and to make sure I changed my connection to a different service and operator and I still have the same issue. Any ideias on how I can handle this?

I am facing the same problem from my side too.

Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref f7de9bd4-0138-4474-9cae-f6fbdab1172e::nyipwx1yvethbamytxmn7yl3f: “/package-lock.json”: not found

The error message from your logs tells me it’s an issue specific to how your images are being built?

Can you try using fly deploy --local-only and see if it works for you? (fyi, that will use your local docker instance to perform the image build and push it to our registry)

Let me know if that works for you.

It doesn’t work. This is the result:

tion is valid
--> Verified app config
==> Building image
Error: failed to fetch an image or build from source: docker is unavailable to build the deployment image

You need to have docker locally & running, as indicated from my previous message.

oh… So this will be the solution? Just wondering because I’ve never had to do this. I wanted to understand what happened for this to stop working all of a sudden.

Let me see if we get some other hints before I have to work with docker local instances. Thanks!

Did it work when you used the --local flag? If it did, then it’s worth an internal investigation on our end.

For me to understand that I need to install docker?

It didnt work

Can you share your output with me?

==> Verifying app config
Validating /Users/hugocosteira/Work/rails/rush-advantage/fly.toml
✓ Configuration is valid
→ Verified app config
==> Building image
Error: failed to fetch an image or build from source: docker is unavailable to build the deployment image

I’ve dowanload docker and opened it. Do I need to do anything else?

What this error messages is saying is that your Dockerfile specifies that you want to COPY (upload) this file, and it isn’t present on our source machine.

Generally projects that use node don’t have both package-lock.json and yarn.lock files, they have one or the over depending on the package manager that they use.

Removing package-lock.json from your Dockerfile will get you further, but I’d suggest running:

bin/rails generate dockerfile

This will generate a new Dockerfile (and optionally update fly.toml, .docker-ignore and other files) based on your current source. Don’t worry, it will prompt you before proceeding, and you can view diffs and chose to accept or reject changes.

Hey everyone, I am getting the same error:
Remote builder fly-builder-hidden-flower-8364 ready
Error: failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See Fly Launch configuration (fly.toml) · Fly Docs

I did this before without much issues, so unsure why this is happening now.

That’s a different error. The following will generate a dockerfile for you:

bundle add dockerfile-rails --optimistic --group development
bin/rails generate dockerfile

You may already ahve dockerfile-rails installed, if so ignore the error the first command provides and proceed to the next.

Thanks! This fixed my issue. I dont know why it started to happen, but it’s now fixed. :slight_smile:

1 Like

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