Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.
Merged
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
33 changes: 33 additions & 0 deletions src/Docker/Manager/ImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,39 @@ public function pull($name, $tag = 'latest', callable $callback = null)
return $image;
}

/**
* Push an image.
*
* @param string $name
* @param string $tag
* @param string $registryAuth
* @param callable $callback
*
* @throws \Docker\Exception\UnexpectedStatusCodeException
*
* @return Image
*/
public function push($name, $tag, $registryAuth, callable $callback = null)
{
if (null === $callback) {
$callback = function () {};
}

$response = $this->client->post(['/images/{image}/push', ['image' => $name, 'tag' => $tag]], [
'headers' => [
'X-Registry-Auth' => $registryAuth
],
'callback' => $callback,
'wait' => true,
]);

if ($response->getStatusCode() !== "200") {
throw UnexpectedStatusCodeException::fromResponse($response);
}

return new Image($name, $tag);
}

/**
* Remove an image from docker daemon
*
Expand Down