@@ -13,6 +13,22 @@ class ContainerCreate extends \Docker\API\Runtime\Client\BaseEndpoint implements
1313 *
1414 * @var string $name Assign the specified name to the container. Must match
1515 * `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`.
16+ * @var string $platform Platform in the format `os[/arch[/variant]]` used for image lookup.
17+ *
18+ * When specified, the daemon checks if the requested image is present
19+ * in the local image cache with the given OS and Architecture, and
20+ * otherwise returns a `404` status.
21+ *
22+ * If the option is not set, the host's native OS and Architecture are
23+ * used to look up the image in the image cache. However, if no platform
24+ * is passed and the given image does exist in the local image cache,
25+ * but its OS or architecture does not match, the container is created
26+ * with the available image, and a warning is added to the `Warnings`
27+ * field in the response, for example;
28+ *
29+ * WARNING: The requested image's platform (linux/arm64/v8) does not
30+ * match the detected host platform (linux/amd64) and no
31+ * specific platform was requested
1632 *
1733 * }
1834 */
@@ -52,10 +68,11 @@ public function getExtraHeaders(): array
5268 protected function getQueryOptionsResolver (): \Symfony \Component \OptionsResolver \OptionsResolver
5369 {
5470 $ optionsResolver = parent ::getQueryOptionsResolver ();
55- $ optionsResolver ->setDefined (['name ' ]);
71+ $ optionsResolver ->setDefined (['name ' , ' platform ' ]);
5672 $ optionsResolver ->setRequired ([]);
5773 $ optionsResolver ->setDefaults ([]);
5874 $ optionsResolver ->addAllowedTypes ('name ' , ['string ' ]);
75+ $ optionsResolver ->addAllowedTypes ('platform ' , ['string ' ]);
5976
6077 return $ optionsResolver ;
6178 }
@@ -66,14 +83,14 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver
6683 * @throws \Docker\API\Exception\ContainerCreateConflictException
6784 * @throws \Docker\API\Exception\ContainerCreateInternalServerErrorException
6885 *
69- * @return \Docker\API\Model\ContainersCreatePostResponse201 |null
86+ * @return \Docker\API\Model\ContainerCreateResponse |null
7087 */
7188 protected function transformResponseBody (\Psr \Http \Message \ResponseInterface $ response , \Symfony \Component \Serializer \SerializerInterface $ serializer , string $ contentType = null )
7289 {
7390 $ status = $ response ->getStatusCode ();
7491 $ body = (string ) $ response ->getBody ();
7592 if ((null === $ contentType ) === false && (201 === $ status && false !== mb_strpos ($ contentType , 'application/json ' ))) {
76- return $ serializer ->deserialize ($ body , 'Docker \\API \\Model \\ContainersCreatePostResponse201 ' , 'json ' );
93+ return $ serializer ->deserialize ($ body , 'Docker \\API \\Model \\ContainerCreateResponse ' , 'json ' );
7794 }
7895 if ((null === $ contentType ) === false && (400 === $ status && false !== mb_strpos ($ contentType , 'application/json ' ))) {
7996 throw new \Docker \API \Exception \ContainerCreateBadRequestException ($ serializer ->deserialize ($ body , 'Docker \\API \\Model \\ErrorResponse ' , 'json ' ), $ response );
0 commit comments