...
1# `gcrane`
2
3<img src="../../images/gcrane.png" width="40%">
4
5This tool implements a superset of the [`crane`](../crane/README.md) commands, with
6additional commands that are specific to [gcr.io](https://gcr.io).
7
8Note that this relies on some implementation details of GCR that are not
9consistent with the [registry spec](https://docs.docker.com/registry/spec/api/),
10so this may break in the future.
11
12## Installation
13
14Download [latest release](https://github.com/google/go-containerregistry/releases/latest).
15
16Install manually:
17
18```
19go install github.com/google/go-containerregistry/cmd/gcrane@latest
20```
21
22## Commands
23
24### ls
25
26`gcrane ls` exposes a more complex form of `ls` than `crane`, which allows for
27listing tags, manifests, and sub-repositories.
28
29### cp
30
31`gcrane cp` supports a `-r` flag that copies images recursively, which is useful
32for backing up images, georeplicating images, or renaming images en masse.
33
34### gc
35
36`gcrane gc` will calculate images that can be garbage-collected.
37By default, it will print any images that do not have tags pointing to them.
38
39This can be composed with `gcrane delete` to actually garbage collect them:
40```shell
41gcrane gc gcr.io/${PROJECT_ID}/repo | xargs -n1 gcrane delete
42```
43
44## Images
45
46You can also use gcrane as docker image
47
48```sh
49$ docker run --rm gcr.io/go-containerregistry/gcrane ls gcr.io/google-containers/busybox
50gcr.io/google-containers/busybox@sha256:4bdd623e848417d96127e16037743f0cd8b528c026e9175e22a84f639eca58ff
51gcr.io/google-containers/busybox:1.24
52gcr.io/google-containers/busybox@sha256:545e6a6310a27636260920bc07b994a299b6708a1b26910cfefd335fdfb60d2b
53gcr.io/google-containers/busybox:1.27
54gcr.io/google-containers/busybox:1.27.2
55gcr.io/google-containers/busybox@sha256:d8d3bc2c183ed2f9f10e7258f84971202325ee6011ba137112e01e30f206de67
56gcr.io/google-containers/busybox:latest
57```
58
59And it's also available with a shell, at the `:debug` tag:
60
61```sh
62docker run --rm -it --entrypoint "/busybox/sh" gcr.io/go-containerregistry/gcrane:debug
63```
64
65Tagged debug images are available at `gcr.io/go-containerregistry/gcrane/debug:[tag]`.
View as plain text