Skip to main content
Version: 5.12

Configure Terminal

There are two main modes how to develop with DevSpace, by streaming the log output of pods in DevSpace or by opening a terminal to the pod you would like to develop with. If you prefer the latter, you can configure the dev.terminal option to tell DevSpace to open a terminal to a target container.

In the dev.terminal section in the devspace.yaml you can configure the terminal:

images:
frontend:
image: myregistry/appfrontend
dependencies:
- name: backend
source:
path: backend
deployments:
- name: frontend
helm:
componentChart: true
values:
containers:
- image: myregistry/appfrontend
command: ["sleep"]
args: ["999999999"]
dev:
terminal:
imageName: frontend
workDir: '/path/to/my/workdir'
# If you would like to open a different shell or start
# it with a different command you can also use
command: ["bash"]
Sleeping Container

You will need to make sure that the container has a terminal equipped and is sleeping so that you can start your application.

Configuration#

imageName#

The imageName expects a string and can be used to select a container based on an image specified in images or in a dependency.

Example: Setting imageName#

images:
frontend:
image: myregistry/appfrontend
backend:
image: myregistry/appbackend
deployments:
- name: backend
helm:
componentChart: true
values:
containers:
- image: myregistry/appbackend
- name: frontend
helm:
componentChart: true
values:
containers:
- image: myregistry/appfrontend
command: ["sleep"]
args: ["999999999"]
dev:
terminal:
imageName: backend
note

If you specify neither imageName nor labelSelector, DevSpace will ask the user which pod to select if it finds more than 1

labelSelector#

The labelSelector option expects a label selector map to select a pod based on labels. If multiple pods match, the newest will be selected and DevSpace waits until that pod is running.

Example: Setting labelSelector#

dev:
terminal:
labelSelector:
app: my-app
# If the pod has multiple containers make sure to set this
containerName: container1

containerName#

If you select a pod via labelSelector and the pod has multiple containers, you'll need to specify a container name with this option.

namespace#

If this option is specified DevSpace will search the pod in this namespace.

workDir#

If this option is specified DevSpace will open the shell in the specified working directory.

command#

The command option expects a string array as optional configuration for how to open the shell for terminal forwarding. If this option is specified, workDir will not work anymore.

Command Termination

If command is a non-interactive command that terminates, DevSpace will run the command and exits after the command has terminated.