diff --git a/src/DockerClientFactory.php b/src/DockerClientFactory.php index 39b07e89..c9bf92d4 100644 --- a/src/DockerClientFactory.php +++ b/src/DockerClientFactory.php @@ -28,13 +28,14 @@ public static function create(array $config = [], ?PluginClientFactory $pluginCl $host = preg_match('/unix:\/\//', $config['remote_socket']) ? 'http://localhost' : $config['remote_socket']; $pluginClientFactory ??= new PluginClientFactory(); + $dockerClientVersion = getenv('DOCKER_API_VERSION') ? getenv('DOCKER_API_VERSION') : 'v1.45'; return $pluginClientFactory->createClient( $socketClient, [ new ContentLengthPlugin(), new DecoderPlugin(), - new AddPathPlugin($uriFactory->createUri('/v1.45')), + new AddPathPlugin($uriFactory->createUri('/' . ltrim($dockerClientVersion))), new AddHostPlugin($uriFactory->createUri($host)), new HeaderDefaultsPlugin([ 'host' => parse_url($host, \PHP_URL_HOST),