diff --git a/docker.go b/docker.go index efb324aa54..17e20de694 100644 --- a/docker.go +++ b/docker.go @@ -679,14 +679,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 9349c4fedc..71039e863e 100644 --- a/docker_test.go +++ b/docker_test.go @@ -1279,8 +1279,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"), },