You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... the documentation does not mention anything about my problem
... there are no open or closed issues that are related to my problem
Description
I’ve encountered what seems to be unexpected behavior regarding the dockerfile and context target attributes in a docker-bake.hcl file.
When dockerfile is set to a path relative to the docker-bake.hcl file, everything works as expected, and the build succeeds.
However, when the context attribute is set to a subdirectory, the build fails with the following error:
ERROR: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory
It appears that the dockerfile path is treated as relative to the context directory, not the docker-bake.hcl file. While this behavior is logical in isolation, it is inconsistent with how paths are handled in other tools like docker-compose.yaml, where both attributes are interpreted as relative to the file defining them.
Expected behaviour
Both dockerfile and context (and by extension contexts) should consistently resolve relative paths from the docker-bake.hcl file to maintain consistency across the toolset.
Alternatively the docs could be updated to explicitly explain the relationship between these attributes.
Actual behaviour
The dockerfile path is unexpectedly relative to the context, causing the build to fail when context is set.
Contributing guidelines
I've found a bug and checked that ...
Description
I’ve encountered what seems to be unexpected behavior regarding the
dockerfile
andcontext
target attributes in adocker-bake.hcl
file.When
dockerfile
is set to a path relative to thedocker-bake.hcl
file, everything works as expected, and the build succeeds.However, when the
context
attribute is set to a subdirectory, the build fails with the following error:It appears that the
dockerfile
path is treated as relative to thecontext
directory, not thedocker-bake.hcl
file. While this behavior is logical in isolation, it is inconsistent with how paths are handled in other tools likedocker-compose.yaml
, where both attributes are interpreted as relative to the file defining them.Expected behaviour
Both
dockerfile
andcontext
(and by extensioncontexts
) should consistently resolve relative paths from thedocker-bake.hcl
file to maintain consistency across the toolset.Alternatively the docs could be updated to explicitly explain the relationship between these attributes.
Actual behaviour
The
dockerfile
path is unexpectedly relative to thecontext
, causing the build to fail whencontext
is set.Buildx version
github.com/docker/buildx v0.17.1-desktop.1 1a2ee7e8d945b88fdc18f1948da491c2f540dec9
Docker info
Builders list
Configuration
This issue arose while working in a monorepo with multiple Lambda functions sharing a single
Dockerfile
. Here’s an example structure:Example
docker-bake.hcl
Build logs
Additional info
No response
The text was updated successfully, but these errors were encountered: