cli icon indicating copy to clipboard operation
cli copied to clipboard

Option `--build-no-cache` appears to use cache

Open jcarpinelli-bdai opened this issue 10 months ago • 1 comments

I am trying to understand how (and where) Devcontainers are cached by the CLI. When I make a change to devcontainer.json, VSCode prompts me to rebuild the container. I'm trying to use the CLI to accomplish this same thing: running devcontainer up, and reflecting new changes to devcontainer.json.

Running the following command does not reflect new changes to devcontainer.json, even when all Docker containers are stopped. The only way I can get the CLI to completely rebuild seems to be calling docker rm on all stopped containers. Am I missing something?

devcontainer up \
  --workspace-folder . \
  --workspace-mount-consistency consistent \ # my naive attempt to get the CLI to notice recent changes to `devcontainer.json`
  --build-no-cache # another naive attempt by me to rebuild recent changes to `devcontainer.json`

jcarpinelli-bdai avatar Apr 09 '24 15:04 jcarpinelli-bdai

--remove-existing-container will run a new docker build that should pick up your changes.

chrmarti avatar Apr 10 '24 07:04 chrmarti

That works! Thanks for your help. What is the difference between --build-no-cache and --remove-existing-container?

jcarpinelli-bdai avatar May 04 '24 13:05 jcarpinelli-bdai

--build-no-cache only applies when the image is built and that only happens when there is no container or --remove-existing-container is given.

chrmarti avatar May 06 '24 07:05 chrmarti