I'm spawning Docker containers using Terraform's Docker provider, but fail to understand how to pass them environment variables.
The project's documentation on the env
option states :
env - (Optional, set of strings) Environment variables to set.
What is a "set of strings" in context ? Can you provide an example docker container resource declaration that uses the env
option ?
From Terraforming a Docker environment:
# Start elastic container
resource "docker_container" "elastic" {
image = "${docker_image.elastic.latest}"
name = "elastic"
hostname = "elastic"
env = ["SERVICE=elastic", "PROJECT=stage", "ENVIRONMENT=operations"]
restart= "no"
must_run="true"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With