`subdir not supported yet` while it should be supported
See original GitHub issueBehaviour
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
- Fork https://github.com/jkulak/gh-actions-test
- Commit any new file/change
- 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
- Repository URL (if public): https://github.com/jkulak/gh-actions-test
- Build URL (if public): https://github.com/jkulak/gh-actions-test/runs/7976332899?check_suite_focus=true
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
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:
- Created a year ago
- Comments:9 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you, it solves the issue.
The docs update makes it clear. 👍🏽
The docs update is very good at explaining it. But if you need extra clarification:
buildx
usesBuildKit
, anddocker
(Docker Engine which providesdocker
migrated to themoby
project since 2022. Themoby
README doesn’t mention it, but if you view their releases page, you can see that’s the case).docker
releases provide their ownbuildx
by default, but it’s version is too old to have the subdir support.buildx
can be installed separately (whichsetup-buildx-action
will do for you, and you have skipped this in your shared config, you need it as astep
beforebuild-push-action
), doing so you can get a new enough version that hasBuildKit
version with thesubdir
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 yourbuild-push-action
step, you’ll get a newer version ofbuildx
thatdocker
can use (via this actionsdocker-container
builder, instead of the plaindocker
builder).You don’t have to do anything else, just add the
setup-buildx-action
step, like this projects README shows.