Docker how to use boolean value on spec.container.env.value
Is there a way to pass a boolean value to the spec.container.env.value? I want to override with slam boolean env variables in parent docker image ( https://github.com/APSL/docker-thumbor ): UPLOAD_ENABLED
I made a simpler test
If you try the following yaml:
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: DEMO_GREETING
value: true
And try to create it with kubernetes, you got the following error:
kubectl create -f envars.yaml
mistake:
error: error validating "envars.yaml": error validating data: expected type string, for field spec.containers[0].env[0].value, got bool; if you choose to ignore these errors, turn validation off with --validate=false
with validate = false
Error from server (BadRequest): error when creating "envars.yaml": Pod in version "v1" cannot be handled as a Pod: [pos 192]: json: expect char '"' but got char 't'
It also doesn't work with integer values
+3
source to share
1 answer
spec.container.env.value
defined as string
. take a look here:
https://kubernetes.io/docs/api-reference/v1.6/#envvar-v1-core
When using this value, you will need to use / convert / flatten the boolean in your container
+4
source to share