@@ -536,7 +536,7 @@ public function containerRemove($container, $v = false, $force = false)
536536 * Copy files or folders of container id
537537 *
538538 * This resolves with a string in the TAR file format containing all files
539- * specified in the $config array .
539+ * specified in the given $path .
540540 *
541541 * Keep in mind that this means the whole string has to be kept in memory.
542542 * For bigger containers it's usually a better idea to use a streaming approach,
@@ -547,13 +547,13 @@ public function containerRemove($container, $v = false, $force = false)
547547 * work is clue/tar-react (see links).
548548 *
549549 * @param string $container container ID
550- * @param array $config resources to copy `array('Resource' => 'file.txt')` (see link)
550+ * @param string $resource path to file or directory to copy
551551 * @return PromiseInterface Promise<string> tar stream
552552 * @link https://docs.docker.com/reference/api/docker_remote_api_v1.15/#copy-files-or-folders-from-a-container
553553 * @link https://github.com/clue/php-tar-react library clue/tar-react
554554 * @see self::containerCopyStream()
555555 */
556- public function containerCopy ($ container , $ config )
556+ public function containerCopy ($ container , $ path )
557557 {
558558 return $ this ->postJson (
559559 $ this ->uri ->expand (
@@ -562,15 +562,17 @@ public function containerCopy($container, $config)
562562 'container ' => $ container
563563 )
564564 ),
565- $ config
565+ array (
566+ 'Resource ' => $ path
567+ )
566568 )->then (array ($ this ->parser , 'expectPlain ' ));
567569 }
568570
569571 /**
570572 * Copy files or folders of container id
571573 *
572574 * This returns a stream in the TAR file format containing all files
573- * specified in the $config array .
575+ * specified in the given $path .
574576 *
575577 * This works for (any number of) files of arbitrary sizes as only small chunks have to
576578 * be kept in memory.
@@ -583,13 +585,13 @@ public function containerCopy($container, $config)
583585 * the normal stream events.
584586 *
585587 * @param string $container container ID
586- * @param array $config resources to copy `array('Resource' => ' file.txt')` (see link)
588+ * @param string $path path to file or directory to copy
587589 * @return ReadableStreamInterface tar stream
588590 * @link https://docs.docker.com/reference/api/docker_remote_api_v1.15/#copy-files-or-folders-from-a-container
589591 * @link https://github.com/clue/php-tar-react library clue/tar-react
590592 * @see self::containerCopy()
591593 */
592- public function containerCopyStream ($ container , $ config )
594+ public function containerCopyStream ($ container , $ path )
593595 {
594596 return $ this ->streamingParser ->parsePlainStream (
595597 $ this ->browser ->withOptions (array ('streaming ' => true ))->post (
@@ -602,7 +604,9 @@ public function containerCopyStream($container, $config)
602604 array (
603605 'Content-Type ' => 'application/json '
604606 ),
605- $ this ->json ($ config )
607+ $ this ->json (array (
608+ 'Resource ' => $ path
609+ ))
606610 )
607611 );
608612 }
0 commit comments