Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to build stack when build and run Dockerfiles are the same #66

Closed
sophiewigmore opened this issue May 16, 2022 · 5 comments · Fixed by #72
Closed

Failure to build stack when build and run Dockerfiles are the same #66

sophiewigmore opened this issue May 16, 2022 · 5 comments · Fixed by #72
Assignees
Labels
bug Something isn't working

Comments

@sophiewigmore
Copy link
Member

sophiewigmore commented May 16, 2022

In paketo-buildpacks/dotnet-core#653, a user (@lamw) reported seeing a failure when building a Powershell-based image on Mac:

❯ jam create-stack --config stack.toml --build-output build.oci --run-output run.oci
Building photon-powershell
  Building on linux/amd64
    Building base images
      Build complete for base images
    build: Decorating base image
      Adding CNB_* environment variables
      Adding io.buildpacks.stack.* labels
      Creating cnb user
    run: Decorating base image
      Adding io.buildpacks.stack.* labels
      Creating cnb user
    build: Updating image
    run: Updating image
Error: Error: No such image: paketo.io/stack/87zgdlj0a5
Usage:
  jam create-stack [flags]

Flags:
      --build-output string   path to output the build image OCI archive (required)
      --config string         path to a stack descriptor file (required)
  -h, --help                  help for create-stack
      --run-output string     path to output the run image OCI archive (required)
      --secret strings        secret to be passed to your Dockerfile

failed to execute: Error: No such image: paketo.io/stack/87zgdlj0a5

I was able to reproduce this error on my Mac, when passing in the same stack.toml file, and setting up a powershell Dockerfile .

It appears that the run image build phase succeeds and the image is on the Docker daemon during the build, but for some reason the run image is missing from the Docker daemon when the run image update step runs.

It looks like this error does not occur when building the Tiny stack, for example on Mac

Issue

We should investigate why this is occurring and put in a fix to the create-stack codebase. If it's a problem with the Dockerfile used, we should make usage information clearer for users.
We should also try to reproduce this failure on a linux machine and see if the same error crops up.

@sophiewigmore sophiewigmore moved this to ❓Not scoped in Paketo Workstreams May 16, 2022
@sophiewigmore sophiewigmore added the bug Something isn't working label May 16, 2022
@sophiewigmore sophiewigmore moved this from ❓Not scoped to 📝 Todo in Paketo Workstreams May 16, 2022
@sophiewigmore sophiewigmore moved this from 📝 Todo to ❓Not scoped in Paketo Workstreams May 16, 2022
@sophiewigmore
Copy link
Member Author

Update: this error occurs on both Linux and Mac.

@sophiewigmore
Copy link
Member Author

sophiewigmore commented May 27, 2022

Another update: this error appears to be from using the same Dockerfile for both the build and run images. It appears that the two generated images have the same Image ID in the docker daemon which causes some problems with the run image. I was able to successfully build by using a separate Dockerfile for the run image with a small change made to it.

I believe the error comes from this line when the run image is being updated, the build image with the same tag has already been updated, and both images are gone. That's because the build image is updated then cleanup happens of all images with the same ID.

@sophiewigmore
Copy link
Member Author

sophiewigmore commented May 27, 2022

Should users be able to use the same Dockerfile for build and run? (in my opinion, yes). If so, this is a bug we should resolve.

@sophiewigmore sophiewigmore moved this to ❓Not scoped in Paketo Workstreams May 27, 2022
@sophiewigmore sophiewigmore self-assigned this May 27, 2022
@sophiewigmore sophiewigmore moved this from ❓Not scoped to 🚧 In Progress in Paketo Workstreams May 27, 2022
@sophiewigmore sophiewigmore changed the title Failure to build stack on Mac Failure to build stack when build and run Dockerfiles are the same May 31, 2022
@robdimsdale
Copy link
Member

@sophiewigmore a quick clarification - is this a problem from using the exact same Dockerfile, or is it also reproducible when using different Dockerfiles with identical content but different file names?

@sophiewigmore
Copy link
Member Author

@robdimsdale identical content but different file names still produce the buggy behaviour

@sophiewigmore sophiewigmore moved this from 🚧 In Progress to 📨 PR Opened in Paketo Workstreams Jun 3, 2022
Repository owner moved this from 📨 PR Opened to ✅ Done in Paketo Workstreams Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants