@@ -45,11 +45,7 @@ public async Task<CreateContainerResponse> CreateContainerAsync(CreateContainerP
4545 throw new ArgumentNullException ( nameof ( parameters ) ) ;
4646 }
4747
48- IQueryString ? queryParameters = null ;
49- if ( ! string . IsNullOrEmpty ( parameters . Name ) )
50- {
51- queryParameters = new QueryString < CreateContainerParameters > ( parameters ) ;
52- }
48+ var queryParameters = new QueryString < CreateContainerParameters > ( parameters ) ;
5349
5450 var data = new JsonRequestContent < CreateContainerParameters > ( parameters , DockerClient . JsonSerializer ) ;
5551
@@ -130,10 +126,13 @@ public async Task<MultiplexedStream> GetContainerLogsAsync(string id, ContainerL
130126 var containerInspectResponse = await InspectContainerAsync ( id , cancellationToken )
131127 . ConfigureAwait ( false ) ;
132128
129+ var containerConfig = containerInspectResponse . Config
130+ ?? throw new InvalidOperationException ( "Container inspect response did not include container configuration." ) ;
131+
133132 var response = await _client . MakeRequestForStreamAsync ( [ NoSuchContainerHandler ] , HttpMethod . Get , $ "containers/{ id } /logs", queryParameters , null , null , cancellationToken )
134133 . ConfigureAwait ( false ) ;
135134
136- return new MultiplexedStream ( response , ! containerInspectResponse . Config . Tty ) ;
135+ return new MultiplexedStream ( response , ! containerConfig . Tty ) ;
137136 }
138137
139138 public async Task < IList < ContainerFileSystemChangeResponse > > InspectChangesAsync ( string id , CancellationToken cancellationToken = default )
@@ -350,10 +349,13 @@ public async Task<MultiplexedStream> AttachContainerAsync(string id, ContainerAt
350349 var containerInspectResponse = await InspectContainerAsync ( id , cancellationToken )
351350 . ConfigureAwait ( false ) ;
352351
352+ var containerConfig = containerInspectResponse . Config
353+ ?? throw new InvalidOperationException ( "Container inspect response did not include container configuration." ) ;
354+
353355 var response = await _client . MakeRequestForHijackedStreamAsync ( [ NoSuchContainerHandler ] , HttpMethod . Post , $ "containers/{ id } /attach", queryParameters , null , null , cancellationToken )
354356 . ConfigureAwait ( false ) ;
355357
356- return new MultiplexedStream ( response , ! containerInspectResponse . Config . Tty ) ;
358+ return new MultiplexedStream ( response , ! containerConfig . Tty ) ;
357359 }
358360
359361 public async Task < ContainerWaitResponse > WaitContainerAsync ( string id , CancellationToken cancellationToken = default )
0 commit comments