Skip to main content
Version: 6.x (Latest)

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:

  1. Find the Kubernetes pod that contains the dev container according to the selectors defined for this dev container.
  2. Find the replica owner that this pod was created from (e.g. Deployment, StatefulSet, etc.)
  3. Scale down the replica number for the replica owner object, i.e. set replicas: 0 for the Deployment, StatefulSet, etc.
  4. Clone the replica owner object to create a new Deployment/StatefulSet with the name [old-object-name]-devspace
  5. Apply the modifications to the newly created Deployment/StatefulSet, e.g. swap out the image, add env vars, etc.
  6. 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

Modifications

devImage required string

DevImage is the image to use for this container and will replace the existing image if necessary.

command required string[]

Command can be used to override the entrypoint of the container

args required string[]

Args can be used to override the args of the container

workingDir required string

WorkingDir can be used to override the working dir of the container

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.

name required string

Name of the environment variable

value required string

Value of the environment variable

resources required

Resources can be used to override the resource definitions of the container

requests required <request_name>:string

Requests are the requests part of the resources

limits required <limit_name>:string

Limits are the limits part of the resources

persistenceOptions required

PersistenceOptions are additional options for persisting paths within this pod

size required string

Size is the size of the created persistent volume in Kubernetes size notation like 5Gi

storageClassName required string

StorageClassName is the storage type DevSpace should use for this persistent volume

accessModes required string[]

AccessModes are the access modes DevSpace should use for the persistent volume

readOnly required boolean false

ReadOnly specifies if the volume should be read only

name required string

Name is the name of the PVC that should be created. If a PVC with that name already exists, DevSpace will use that PVC instead of creating one.

patches required object[]

Patches are additional changes to the pod spec that should be applied

op required string

Operation is the path operation to do. Can be either replace, add or remove

path required string

Path is the config path to apply the patch to

value required

Value is the value to use for this patch.