Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker build context from Github repo with subdirectory

I’m trying to build a docker context directly from github, where the dockerfiles are placed in a subdirectory. I get the error failed to solve with frontend dockerfile.v0: failed to read dockerfile: failed to load cache key: subdir not supported yet. 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 of buildx is github.com/docker/buildx v0.7.1 and i found in this post (https://www.docker.com/blog/engineering-update-buildkit-0-9-and-docker-buildx-0-6-releases/) that subdirectories from git context are supported from version 0.6! Does anyone have similar problems?

I have tried to turn off BuildKit with DOCKER_BUILDKIT=0 and COMPOSE_DOCKER_CLI_BUILD=1 but this causes problems on other containers in my compose stack and some temporary containers are not removed after build ending up with a long list of created containers.

This is tested with docker build https://[email protected]/<my-repo>#develop:mysql, docker-compose version: 1.29.2, build 5becea4c and docker compose version v2.2.1. It works for the dockerfile placed in root dir, so the access level works and repo spelling is correct.

like image 321
Mads Mønster Avatar asked May 09 '26 12:05

Mads Mønster


1 Answers

I resolved this by disabling buildkit in Docker Desktop.

  • load docker desktop
  • go to Preferences
  • go to Docker Engine
  • edit the settings json. Mine was
{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    "buildkit": false
  }
}
  • Apply and Restart
like image 156
codeAline Avatar answered May 11 '26 03:05

codeAline



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!