Dev-Optimized Images For Dev Containers
One of the most common modifications for a dev container is to replace the stable/prod image of the container with a generic prebuilt dev image.
dev:
backend:
imageSelector: ghcr.io/org/project/image
devImage: ghcr.io/loft-sh/devspace-containers/python:3-alpine
command: ["sleep", "100000"]
The example above selects the container with the stable/prod image ghcr.io/org/project/image
and replaces the image with the prebuilt dev-optimized image ghcr.io/loft-sh/devspace-containers/python:3-alpine
.
Note: We're overwriting the entrypoint here to keep the container alive.
Prebuilt images used for development are usually generic images that do not contain your application or any source code. They often only contain the necessary tooling to build, run, and debug your application in the appropriate language.
In our example above, the image ghcr.io/loft-sh/devspace-containers/python:3-alpine
is a generic image for the development of Python based applications, so it contains tools like python
and pip
but does not contain any Python source code. Instead, you would be using the file sync feature in DevSpace to sync your source code from your local computer into the dev container to then be able to build and run your Python application using the tools provided inside the container.
Config Reference
devImage
required string
DevImage is the image to use for this container and will replace the existing image
if necessary.
devImage
required string