dotcloud/docker — pull request #3216 by wking (2013-12-15 02:56:33+00:00)
Title: copy from image to host (`docker cp -image <image>:…`)

It would be nice if we didn't have to spin up a container just to extract a file or directory from an image. We can currently accomplish this with:

$ CONTAINER=$(docker run -v ${HOSTPATH}:/tmp ${IMAGE} cp -rp ${PATH} /tmp/)
$ docker rm "${CONTAINER}"

On `#docker`, `bkc_` suggesed an `-i[mage]` flag for disambiguating container-vs-image for `docker cp`:

$ docker cp ${CONTAINER}:${PATH} ${HOSTPATH}
$ docker cp -image ${IMAGE}:${PATH} ${HOSTPATH}

This would involve an API extension (`/images/(name)/copy`, mirroring `/containers/(id)/copy`), and the `-i[mage]` flag would swap the client between API URLs. I'll take a stab at implementing this if it sounds reasonable.