Is it possible to set the working directory when launching a container with Kubernetes ?
Yes, through the workingDir
field of the container spec. Here's an example replication controller with an nginx container that has workingDir
set to /workdir
:
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: mynginximage
workingDir: /workdir