We use
RUN curl -fsSL https://aka.ms/install-azd.sh | bash
as the last step of the dockerfile for the .devcontainer settings. This build step is automatically cache by docker and won't be built if there are no changes on previous layers.
From docker:
Suppose you have a RUN apt-get update && apt-get upgrade -y step in your Dockerfile to upgrade all the software packages in your Debian-based image to the latest version.
This doesn’t mean that the images you build are always up to date. Rebuilding the image on the same host one week later will still get you the same packages as before. The only way to force a rebuild is by making sure that a layer before it has changed, or by clearing the build cache using [docker builder prune](https://docs.docker.com/engine/reference/commandline/builder_prune/).
https://docs.docker.com/build/cache/
Because of this, as a user, I can get previous azd version which is part of docker cache. I need to run docker builder prune to make sure I am getting the latest, but the build time will also be impacted, as I will be re-building all layers as the very first time.
What about moving azd install to devcontainer.json instead?