Merge pull request #6547 from hashicorp/b-docker-task-user

docs: Docker driver supports task user option
This commit is contained in:
Mahmood Ali
2019-10-25 09:22:28 -04:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -1009,6 +1009,23 @@ func TestDockerDriver_CreateContainerConfig(t *testing.T) {
require.Equal(t, containerName, c.Name)
}
func TestDockerDriver_CreateContainerConfig_User(t *testing.T) {
t.Parallel()
task, cfg, _ := dockerTask(t)
task.User = "random-user-1"
require.NoError(t, task.EncodeConcreteDriverConfig(cfg))
dh := dockerDriverHarness(t, nil)
driver := dh.Impl().(*Driver)
c, err := driver.createContainerConfig(task, cfg, "org/repo:0.1")
require.NoError(t, err)
require.Equal(t, task.User, c.Config.User)
}
func TestDockerDriver_CreateContainerConfig_Labels(t *testing.T) {
t.Parallel()

View File

@@ -413,6 +413,8 @@ The `docker` driver supports the following configuration in the job spec. Only
* `pids_limit` - (Optional) An integer value that specifies the pid limit for
the container. Defaults to unlimited.
Additionally, the docker driver supports customization of the container's user through the task's [`user` option](/docs/job-specification/task.html#user).
### Container Name
Nomad creates a container after pulling an image. Containers are named