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.

"cacheFrom" value not considered when building dev container features

See original GitHub issue

The build.cacheFrom value allows you to publish an image, and then use it as a local cache for subsequent builds on another machine (as does the Docker Compose equivalent). Currently contents of the image in cacheFrom do not appear to be being used during the dev container features build step which reduces the utility of it pretty significantly.

Repro:

  1. Go to https://github.com/chuxel/feature-library and create a Codespace, or clone the project locally and create a dev container from it
  2. Watch the Dockerfile build

Expected: Since there is a pre-built image with the “docker-in-docker” feature inside it (see https://github.com/Chuxel/feature-library/blob/main/.github/workflows/devcontainer-image.yaml), the feature docker build reuses the cached result. Actual: The image contents are only used in during the core Dockerfile build not during the feature build

Log section illustrating the cache being used in one case, but not the other.

2022-08-31 19:41:33.478Z: #14 [dev_container_auto_added_stage_label 2/2] RUN su node -c "npm install -g @devcontainers/cli"
2022-08-31 19:41:33.758Z: #14 pulling sha256:0df7bb7c7da4a5becc4ee99cdb66cc9175a54cc0d860b26de69a7376b687e6a9
2022-08-31 19:41:34.206Z: #14 pulling sha256:0df7bb7c7da4a5becc4ee99cdb66cc9175a54cc0d860b26de69a7376b687e6a9 0.4s done
2022-08-31 19:41:38.855Z: #14 CACHED
2022-08-31 19:41:38.997Z: 
2022-08-31 19:41:38.997Z: #15 [dev_containers_target_stage 1/2] COPY --from=dev_containers_feature_content_source . /tmp/build-features/
2022-08-31 19:41:39.107Z: #15 DONE 0.2s
2022-08-31 19:41:39.246Z: 
2022-08-31 19:41:39.247Z: #16 [dev_containers_target_stage 2/2] RUN cd /tmp/build-features/docker-in-docker_1 && export $(cat devcontainer-features.env | xargs) && chmod +x ./install.sh && ./install.sh
2022-08-31 19:42:45.745Z: #16 66.46 DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES=buster bullseye bionic focal jammy
2022-08-31 19:42:45.745Z: #16 66.46 Distro codename  'bullseye'  matched filter  'buster bullseye bionic focal jammy'
2022-08-31 19:42:45.745Z: #16 66.47 Running apt-get update...
2022-08-31 19:42:45.884Z: #16 66.76 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
2022-08-31 19:42:46.022Z: #16 66.78 Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
2022-08-31 19:42:46.022Z: #16 66.78 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
2022-08-31 19:42:46.022Z: #16 66.79 Get:4 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
```

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
Chuxelcommented, Oct 20, 2022

@davidwallacejackson Sorry for the delay! @chrmarti and I have been out-of-office, but @jkeech mentioned @edgonmsft, @joshspicer, or @samruddhikhandale could look at https://github.com/devcontainers/cli/pull/233 @stuartleeks took a quick look as well and it looked good.

1reaction
davidwallacejacksoncommented, Oct 17, 2022

Made a PR with this change and tested it manually – looks like this does, in fact, solve the problem!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dev Container Features - Visual Studio Code
Development containers are a great way to simplify environment set up - they provide a complete coding environment with the tools your project ......
Read more >
Test: Use dev container in CI build #6769 - GitHub
At the end of the file, add the terraform feature: ... Enable explicit CacheFrom when no cacheFrom in devcontainer.json devcontainers/cli#45.
Read more >
Best practices for writing Dockerfiles - Docker Documentation
This document covers recommended best practices and methods for building efficient images. Docker builds images automatically by reading the instructions from a ...
Read more >
Best practices for speeding up builds - Google Cloud
Kaniko cache is a Cloud Build feature that caches container build ... end of the build; therefore using --cache-from is not beneficial if...
Read more >
Enabling Docker Layer Caching - CircleCI
Docker layer caching (DLC) is a great feature to use if building Docker images is a ... Note: DLC has no effect on...
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