Skip to content

[Bug]: container build ignores default/relative build context in mktemp directory, but works with absolute path #1899

Description

@jakubkaczor

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

cd "$(mktemp -d)"

cat > Dockerfile <<'EOF'
FROM debian:stable-slim
COPY . .
RUN cat Dockerfile
EOF

container build

The build fails with:

cat: Dockerfile: No such file or directory

The same happens with:

container build .

But this succeeds:

container build "$PWD"

In my specific example reproduction, the mktemp -d resolved to /var/folders/qf/ng024_6s5kn4z_sczdcdbbkh0000gn/T/tmp.3tuwoUOXS3.

Problem description

When building from a temporary directory created with mktemp -d, the build context appears to be empty if the context is specified implicitly or as ..

The following commands all produce an empty build context:

container build
container build .

However, providing the exact same directory as an absolute path works:

container build "$PWD"

The behavior does not occur when building from a normal directory such as ~/test.

Environment

- OS: ProductName:            macOS
      ProductVersion:         26.5.2
      BuildVersion:           25F84
- Container: container CLI version 1.0.0 (build: release, commit: ee848e3)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions