Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Docker.DotNet/ContainerOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,24 @@ public async Task<ContainerResponse> InspectContainerAsync(string id)

public async Task<CreateContainerResponse> CreateContainerAsync(CreateContainerParameters parameters)
{
IQueryString qs = null;

if (parameters == null)
{
throw new ArgumentNullException("parameters");
}

if (!string.IsNullOrEmpty(parameters.ContainerName)) {
qs = new QueryString<CreateContainerParameters>(parameters);
}

string path = "containers/create";
JsonRequestContent<Config> data = null;
if (parameters.Config != null)
{
data = new JsonRequestContent<Config>(parameters.Config, this.Client.JsonSerializer);
}
DockerApiResponse response = await this.Client.MakeRequestAsync(new[] {NoSuchContainerHandler}, HttpMethod.Post, path, null, data);
DockerApiResponse response = await this.Client.MakeRequestAsync(new[] {NoSuchContainerHandler}, HttpMethod.Post, path, qs, data);
return this.Client.JsonSerializer.DeserializeObject<CreateContainerResponse>(response.Body);
}

Expand Down
3 changes: 3 additions & 0 deletions Docker.DotNet/Models/CreateContainerParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ public class CreateContainerParameters
{
public Config Config { get; set; }

[QueryStringParameter("name", false)]
public string ContainerName { get; set; }

public CreateContainerParameters()
{
}
Expand Down