Skip to content

Commit

Permalink
Merge pull request #2787 from hashicorp/f-docker-test-mac
Browse files Browse the repository at this point in the history
Test #2652 - Docker MAC Address option
  • Loading branch information
schmichael authored Jul 7, 2017
2 parents 5ab252f + eaab2b2 commit ef98449
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
19 changes: 19 additions & 0 deletions client/driver/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,25 @@ func TestDockerDriver_DNS(t *testing.T) {
}
}

func TestDockerDriver_MACAddress(t *testing.T) {
task, _, _ := dockerTask()
task.Config["mac_address"] = "00:16:3e:00:00:00"

client, handle, cleanup := dockerSetup(t, task)
defer cleanup()

waitForExist(t, client, handle.(*DockerHandle))

container, err := client.InspectContainer(handle.(*DockerHandle).ContainerID())
if err != nil {
t.Fatalf("err: %v", err)
}

if container.NetworkSettings.MacAddress != task.Config["mac_address"] {
t.Errorf("expected mac_address=%q but found %q", task.Config["mac_address"], container.NetworkSettings.MacAddress)
}
}

func TestDockerWorkDir(t *testing.T) {
task, _, _ := dockerTask()
task.Config["work_dir"] = "/some/path"
Expand Down
15 changes: 6 additions & 9 deletions website/source/docs/drivers/docker.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The `docker` driver supports the following configuration in the job spec. Only
to use.
* `dns_servers` - (Optional) A list of DNS servers for the container to use
(e.g. ["8.8.8.8", "8.8.4.4"]). *Docker API v1.10 and above only*
(e.g. ["8.8.8.8", "8.8.4.4"]). Requires Docker v1.10 or greater.
* `extra_hosts` - (Optional) A list of hosts, given as host:IP, to be added to
`/etc/hosts`.
Expand All @@ -103,10 +103,10 @@ The `docker` driver supports the following configuration in the job spec. Only
Nomad agent to be configured to allow privileged containers.
* `ipv4_address` - (Optional) The IPv4 address to be used for the container when
using user defined networks. Requires docker 1.13.0 or greater.
using user defined networks. Requires Docker 1.13 or greater.
* `ipv6_address` - (Optional) The IPv6 address to be used for the container when
using user defined networks. Requires docker 1.13.0 or greater.
using user defined networks. Requires Docker 1.13 or greater.
* `labels` - (Optional) A key-value map of labels to set to the containers on
start.
Expand Down Expand Up @@ -151,6 +151,9 @@ The `docker` driver supports the following configuration in the job spec. Only
}
```
* `mac_address` - (Optional) The MAC address for the container to use (e.g.
"02:68:b3:29:da:98").
* `network_aliases` - (Optional) A list of network-scoped aliases, provide a way for a
container to be discovered by an alternate name by any other container within
the scope of a particular network. Network-scoped alias is supported only for
Expand Down Expand Up @@ -185,12 +188,6 @@ The `docker` driver supports the following configuration in the job spec. Only
nomad agent and docker daemon to be configured to allow privileged
containers.
* `mac_address` - (Optional) The mac address for the container to use
(e.g. "02:68:b3:29:da:98").
* `dns_search_domains` - (Optional) A list of DNS search domains for the container
to use.
* `security_opt` - (Optional) A list of string flags to pass directly to
[`--security-opt`](https://docs.docker.com/engine/reference/run/#security-configuration).
For example:
Expand Down

0 comments on commit ef98449

Please sign in to comment.