Nomad: specify environment variables for docker driver

Created on 17 Jan 2016  路  3Comments  路  Source: hashicorp/nomad

This is either a request for a new feature or a request for improved documentation.

When running docker containers, a common pattern is to inject configuration information into the container by using environment variables. From the documentation, I'm not sure how to do this.

Most helpful comment

Hi Daniel, take a look at: https://www.nomadproject.io/docs/jobspec/index.html, you'll be wanting the 'env' setting within the task block. For example, you could add something like this:

env {
  DB_HOST = "db01.example.com"
  DB_USER = "web"
  DB_PASSWORD = "loremipsum"
}

All 3 comments

Hi Daniel, take a look at: https://www.nomadproject.io/docs/jobspec/index.html, you'll be wanting the 'env' setting within the task block. For example, you could add something like this:

env {
  DB_HOST = "db01.example.com"
  DB_USER = "web"
  DB_PASSWORD = "loremipsum"
}

Thanks for the pointer. Looks like I was just looking in the wrong place.

@iverberk. I know this issue is old, but what if you wanted to leverage vault for DB_PASSWORD in your example? TMK, you can't use vault anywhere in the job spec file outside of template.

Asked more directly, is there a way to securely inject passwords or other sensitive items outside of consul template?

Was this page helpful?
0 / 5 - 0 ratings