Skip to content

Commit e7c4ae5

Browse files
committed
Readme
1 parent ade98d8 commit e7c4ae5

File tree

1 file changed

+45
-30
lines changed

1 file changed

+45
-30
lines changed

README.md

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,56 @@
1-
# Docker Registry (golang implementation)
1+
# DLGrab (docker layer grab)
22

33
## Requirements
44

5-
You need to have docker >= 0.5.0 up and running.
5+
You need to have docker running on your local machine. Remote daemons won't
6+
work, though it wouldn't be hard to add them.
67

7-
## Limitations
8+
## Caveats
89

9-
This implementation doesn't provide all the features that are available in the Python implementation of the Docker Registry.
10+
DLGrab shims the api endpoints docker touches when pushing an image. If
11+
Docker starts expecting different responses from these endpoints, DLGrab may
12+
stop working.
1013

11-
## Build and start docker image for registry
14+
That said, it's probably more robust that trying to export directly from the
15+
filesystem.
1216

13-
$ git clone https://github.com/docker/docker-registry.git docker-registry.git
14-
$ cd docker-registry.git/contrib/golang_impl
15-
$ docker build -t docker_registry/golang .
16-
$ docker run -v /data:/data -d -p 80:80 docker_registry/golang
17+
## Build dlgrab
1718

18-
__Notice__: -p 80:80 binds the registry to your local port 80. This is necessary because it seems you currently cannot delete images where
19-
the tag includes a port.
19+
$ git clone https://github.com/aidanhs/dlgrab.git
20+
$ cd dlgrab
21+
$ make
22+
$ ./dlgrab
2023

21-
## Test / Use
24+
## Usage
2225

23-
### Push test image to registry
26+
$ ./dlgrab
27+
Usage for ./dlgrab [flags...] LAYER
28+
LAYER: layer id to export, or image name to export top layer of
29+
--clean=false Remove the temporary tag after use
30+
WARNING: can trigger layer deletion if run on a layer with no children or other references
31+
--debug=false Set log level to debug
32+
-h, --help=false Print this help text
33+
-o, --outdir="." Directory to write layer to
34+
-p=0 Port to use, defaults to a random unallocated port
35+
--registry-format=false Output in the format a registry would use, rather than for an image export
2436

25-
$ docker build -t 127.0.0.1/test/test - << EOF
26-
FROM ubuntu
27-
RUN echo world > /hello
28-
CMD cat /hello
29-
EOF
30-
31-
$ docker push 127.0.0.1/test/test
32-
33-
### Delete local registry image
34-
35-
$ docker rmi 127.0.0.1/test/test
36-
37-
### Run test image
38-
39-
$ docker run 127.0.0.1/test/test
40-
41-
Now the image is fetched from your local registry and executed. Should print out `world`.
37+
The DOCKER_HOST environment variable overrides the default location to find the docker daemon
38+
$ docker history ubuntu:14.04
39+
IMAGE CREATED CREATED BY SIZE
40+
5ba9dab47459 2 weeks ago /bin/sh -c #(nop) CMD [/bin/bash] 0 B
41+
51a9c7c1f8bb 2 weeks ago /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/ 1.895 kB
42+
5f92234dcf1e 2 weeks ago /bin/sh -c echo '#!/bin/sh' > /usr/sbin/polic 194.5 kB
43+
27d47432a69b 2 weeks ago /bin/sh -c #(nop) ADD file:62400a49cced0d7521 188.1 MB
44+
511136ea3c5a 20 months ago 0 B
45+
$ ./dlgrab --clean 51a9c7c1f8bb # this layer is referenced by child images, so --clean is fine
46+
Full layer id found: 51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c
47+
Layer folder will be dumped into .
48+
Writing file: json
49+
Writing file: layer.tar
50+
Export complete
51+
$ ls 51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c
52+
json layer.tar VERSION
53+
$ tar tf 51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c/layer.tar
54+
etc/
55+
etc/apt/
56+
etc/apt/sources.list

0 commit comments

Comments
 (0)