如何设置Kubernetes发布的容器的workdir

时间:2016-04-14 21:49:14

标签: docker kubernetes

使用Kubernetes启动容器时是否可以设置工作目录?

1 个答案:

答案 0 :(得分:32)

是的,通过container specworkingDir字段。这是一个带有nginx容器的复制控制器示例,workingDir设置为/workdir

apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: nginx
    spec:
      containers:
        - name: nginx
          image: mynginximage
          workingDir: /workdir