Is there a way to override this variable with docker compose? I want assign the json string to an environment variable.
{
"HealthChecksUI": {
"HealthChecks": [
{
"Name": "HTTP-Api-Basic",
"Uri": "http://localhost:6457/healthz"
}
]
}
}
Doesn't work like this
environment:
- VIRTUAL_HOST=api.local
- VIRTUAL_PORT=80
- 'HealthChecksUI__HealthChecks__Uri=https://api.local/'
Problem is array I assume
CodePudding user response:
This will do the trick:
version: '3.8'
services:
busybox:
image: busybox
command: ["ash","-c","sleep 3600"]
environment:
JSON: |-
{
"HealthChecksUI": {
"HealthChecks": [
{
"Name": "HTTP-Api-Basic",
"Uri": "http://localhost:6457/healthz"
}
]
}
}
docker exec into the container and echo $JSON will show you the json string.