diff --git a/docker.go b/docker.go index e8bad7c66d..9a6e62163d 100644 --- a/docker.go +++ b/docker.go @@ -743,14 +743,14 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque // prepare mounts mounts := []mount.Mount{} - for hostPath, innerPath := range req.BindMounts { + for innerPath, hostPath := range req.BindMounts { mounts = append(mounts, mount.Mount{ Type: mount.TypeBind, Source: hostPath, Target: innerPath, }) } - for volumeName, innerPath := range req.VolumeMounts { + for innerPath, volumeName := range req.VolumeMounts { mounts = append(mounts, mount.Mount{ Type: mount.TypeVolume, Source: volumeName, diff --git a/docker_test.go b/docker_test.go index 1d8482e0b6..f888ca8279 100644 --- a/docker_test.go +++ b/docker_test.go @@ -1404,8 +1404,8 @@ func TestContainerCreationWithBindAndVolume(t *testing.T) { bashC, err := GenericContainer(ctx, GenericContainerRequest{ ContainerRequest: ContainerRequest{ Image: "bash", - BindMounts: map[string]string{absPath: "/hello.sh"}, - VolumeMounts: map[string]string{volumeName: "/data"}, + BindMounts: map[string]string{"/hello.sh": absPath}, + VolumeMounts: map[string]string{"/data": volumeName}, Cmd: []string{"bash", "/hello.sh"}, WaitingFor: wait.ForLog("done"), },