Dev Container Modifications
DevSpace allows you to modify the selected dev container to optimize it for development.
How does it work?
When any modifications are defined for a dev container, DevSpace will do the following:
- Find the Kubernetes pod that contains the dev container according to the selectors defined for this dev container.
- Find the replica owner that this pod was created from (e.g. Deployment, StatefulSet, etc.)
- Scale down the replica number for the replica owner object, i.e. set
replicas: 0for the Deployment, StatefulSet, etc. - Clone the replica owner object to create a new Deployment/StatefulSet with the name
[old-object-name]-devspace - Apply the modifications to the newly created Deployment/StatefulSet, e.g. swap out the image, add env vars, etc.
- Wait until the a new pod was created from the new Deployment/StatefulSet
Undo Modifications
To undo the changes that DevSpace made to create the modified version of our dev container, you can run:
devspace reset pods
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 command required string[]
Command can be used to override the entrypoint of the container
command required string[] args required string[]
Args can be used to override the args of the container
args required string[] workingDir required string
WorkingDir can be used to override the working dir of the container
workingDir required string env required object[]
Env can be used to add environment variables to the container. DevSpace will
not replace existing environment variables if an environment variable is defined here.
env required object[] resources required
Resources can be used to override the resource definitions of the container
resources required persistenceOptions required
PersistenceOptions are additional options for persisting paths within this pod
persistenceOptions required patches required object[]
Patches are additional changes to the pod spec that should be applied
patches required object[]