Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Some API request seem to not work if we don't try to read the response content #329

Open
soullivaneuh opened this issue Jul 19, 2018 · 1 comment

Comments

@soullivaneuh
Copy link
Contributor

soullivaneuh commented Jul 19, 2018

With this piece of code:

$this->docker->imageCreate($serviceImageName, [
    'fromImage' => $serviceImageName,
], [], Client::FETCH_RESPONSE);

No image is created.

With this one neither:

$response = $this->docker->imageCreate($serviceImageName, [
    'fromImage' => $serviceImageName,
], [], Client::FETCH_RESPONSE);
var_dump($response);

But the image is created if I try to access the response string content:

$response = $this->docker->imageCreate($serviceImageName, [
    'fromImage' => $serviceImageName,
], [], Client::FETCH_RESPONSE);
var_dump($response->getBody()->getContents()); // WORKS!

Very odd. Of course, I don't need the response content here. Any idea?

docker-php/docker-php               v2.0.0       A Docker PHP client
docker-php/docker-php-api           v4.1.35.1    Docker API generated files from OpenAPI Specification

Please note I didn't have this issue with docker-php at 5279929

@soullivaneuh soullivaneuh changed the title Some API request seems to not work if we don't try to read the response content Some API request seem to not work if we don't try to read the response content Jul 19, 2018
@alexeyPalshin
Copy link

alexeyPalshin commented Nov 28, 2018

http connection may be terminated until pull image occurs. Try

       `$createImageStream = $this->client->imageCreate($inputImage, $queryParameters);
        $createImageStream->onFrame(function (CreateImageInfo $imageInfo) {
            if ($imageInfo->getStatus() == 'Pull complete') {
                return;
            }
        });
        $createImageStream->wait();`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants