Tips for working with dev containers
In this section, we will look at a few tips that we can use to fine-tune the experience of working with dev containers. Let's start by looking at how we can automate steps inside the dev container after it has been built.
postCreateCommand and automating pip install
In the early examples in this chapter examples earlier in the chapter, we had to run pip install
after building the dev container, and this is required each time you rebuild the dev container after making changes to its configuration. To avoid this, it might be tempting to add a RUN
step to the dev container Dockerfile to perform pip install
, but I prefer not to put application packages into the dev container image. Application package dependencies tend to evolve over time, and building them into the image (and rebuilding the image to install) feels a little heavyweight. Over time, when working with dev containers, my rule of thumb has become to install tools in the dev container...