Docker

Extension can run actions in a Docker container when container is specified on an extension block:

extension @terraform {
    container = "hashicorp/terraform:1.8.4"
    variables = [ "ARM_TENANT_ID"
                  "ARM_SUBSCRIPTION_ID"
                  "ARM_CLIENT_ID"
                  "ARM_CLIENT_SECRET"
                  "ARM_ACCESS_KEY" ]
}

All actions of this extension will run in the provided container - hence providing both isolation and avoiding configuration discrepancies.

Note actions are run using following docker configuration:

  • Entrypoint and arguments are overriden by action (--entrypoint)
  • Container is removed after execution (--rm)
  • Docker host socket is exposed to container to allow Docker in Docker (-v /var/run/docker.sock)
  • Container USER account is identified and used to map host homedir to USER homedir (-v)
  • Container /tmp is redirected and shared across instances (v)
  • Container workdir is the current project rootdir (-w)
  • Network is set to host (--net=host)
  • IPC is set to host (--ipc=host)
  • PID is set to host (--pid=host)
  • Environment variables can be passed from host to container - see variables property of extensions.
Last updated on