question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`subdir not supported yet` while it should be supported

See original GitHub issue

Behaviour

It is a simple repository with a Dockerfile (in a subdirectory). I want to build the image and push it to Docker Hub. It fails.

Steps to reproduce this issue

  1. Fork https://github.com/jkulak/gh-actions-test
  2. Commit any new file/change
  3. Actions will run, and there will be an ERROR

Expected behaviour

It seems like a simple/basic use case for build-push-action. I would expect it build the Docker image and push it to Docker Hub.

Actual behaviour

Build fails. Seems like the action can not find the Dockerfile, which is located in the ./app directory of the repository.

#1 [internal] load git source https://github.com/***/gh-actions-test.git#7915aa22036b623876c4e04eeda5754b72aafaeb:app
#1 ERROR: subdir not supported yet

Configuration

name: Docker Image CI

on:
    push:
        branches: ["*"]

jobs:
    docker:
        runs-on: ubuntu-latest
        steps:
            - name: Login to DockerHub
              uses: docker/login-action@v2
              with:
                  username: ${{ secrets.DOCKERHUB_USERNAME }}
                  password: ${{ secrets.DOCKERHUB_TOKEN }}
            - name: Build and push
              uses: docker/build-push-action@v3
              with:
                  context: "{{defaultContext}}:app"
                  push: true
                  tags: grabtrack/app:latest

Logs

logs_4.zip

Also:

1s
Run docker/build-push-action@v3
  with:
    context: {{defaultContext}}:app
    push: true
    tags: grabtrack/app:latest
    load: false
    no-cache: false
    pull: false
    github-token: ***
Docker info
Buildx version
  /usr/bin/docker buildx version
  github.com/docker/buildx 0.9.0+azure-[1](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:1) 6113[2](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:2)9fc7f1[3](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:3)65556789bff[4](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:4)747f608d40cdc8a9
/usr/bin/docker buildx build --iidfile /tmp/docker-build-push-0pxVKg/iidfile --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-build-push-0pxVKg/tmp-1[5](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:5)35-gtFtbXRZZaTx --tag grabtrack/app:latest --metadata-file /tmp/docker-build-push-0pxVKg/metadata-file --push https://github.com/***/gh-actions-test.git#7915aa2203[6](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:6)b6238[7](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:7)6c4e04eeda5754b72aafaeb:app
#1 [internal] load git source https://github.com/***/gh-actions-test.git#7915aa22036b623[8](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:8)76c4e04eeda5754b72aafaeb:app
#1 ERROR: subdir not supported yet
------
 > [internal] load git source https://github.com/***/gh-actions-test.git#7[9](https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true#step:3:9)15aa22036b623876c4e04eeda5754b72aafaeb:app:
------
ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: failed to load cache key: subdir not supported yet
Error: buildx failed with: ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: failed to load cache key: subdir not supported yet

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jkulakcommented, Sep 4, 2022

Thank you, it solves the issue.

The docs update makes it clear. 👍🏽

1reaction
polarathenecommented, Sep 2, 2022

It does not.

The docs update is very good at explaining it. But if you need extra clarification:

  • buildx uses BuildKit, and docker (Docker Engine which provides docker migrated to the moby project since 2022. The moby README doesn’t mention it, but if you view their releases page, you can see that’s the case).
  • docker releases provide their own buildx by default, but it’s version is too old to have the subdir support.
  • buildx can be installed separately (which setup-buildx-action will do for you, and you have skipped this in your shared config, you need it as a step before build-push-action), doing so you can get a new enough version that has BuildKit version with the subdir feature support available.

Basically, docker does not yet have the compatibility. You’ll need to wait for a future release to be available.

However if you use setup-buildx-action prior to your build-push-action step, you’ll get a newer version of buildx that docker can use (via this actions docker-container builder, instead of the plain docker builder).

You don’t have to do anything else, just add the setup-buildx-action step, like this projects README shows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for subdirectories when building from git source
The weird thing is that git fetch --filter is not documented (oversight?) but does exist in the code. Another caveat is that --filter...
Read more >
Docker build context from Github repo with subdirectory
I'm using Docker Desktop 4.3.1 (72247) on Mac and it seems to be an issue related to BuildKit and buildx. My current version...
Read more >
Build an Image - Specify Dockerfile Location · Codefresh | Docs
This pipeline checks out the source code of the repository and then builds a dockerfile found at the subfolder docker while still keeping...
Read more >
Module Sources | Terraform - HashiCorp Developer
Module source addresses use a URL-like syntax, but with extensions to support unambiguous selection of sources and additional features.
Read more >
Subdirectory Sites not working | WordPress.org
The site uses subdirectories. Today I wanted to add a new subsite but the upon clicking “Add Site” I'm only able to enter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found