docs: Docker driver supports task user option

Also, add a test case.
This commit is contained in:
Mahmood Ali 2019-10-24 14:00:37 -04:00
parent f4d78ce0ff
commit fe14993582
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, docker driver supports customization of the container user through task [`user` option](/docs/job-specification/task.html#user).
### Container Name
Nomad creates a container after pulling an image. Containers are named