thumbor: Update to post v6.0
[dockerfile.git] / portage / README.md
1 Use volume mounts to avoid including the Portage tree in your images:
2
3     $ docker run --name portage wking/portage
4
5 The container will exit immediately, but you can still
6 [mount][volumes-from] it's exported [VOLUME][] from another container:
7
8     $ docker run --volumes-from portage -i -t wking/gentoo /bin/bash
9     d1a49abc4b3c / # ls /usr/portage/
10     app-accessibility  dev-python        mail-mta         sci-mathematics
11     …
12
13 Changes (e.g. distfiles downloads) are preserved between mounts by the
14 shared `portage` container.  Let's install something in the first
15 container:
16
17     d1a49abc4b3c / # emerge -av netcat
18     …
19     These are the packages that would be fetched, in order:
20
21     Calculating dependencies... done!
22     [ebuild  N     ] dev-libs/libmix-2.05-r6  USE="-static-libs" 78 kB
23     [ebuild  N     ] net-analyzer/netcat-110-r9  USE="crypt ipv6 -static" 108 kB
24
25     Total: 2 packages (2 new), Size of downloads: 186 kB
26
27 Now kill that container and spin up another one:
28
29     $ docker run --volumes-from portage -i -t wking/gentoo /bin/bash
30     187adaf8babd / # emerge -pv netcat
31     …
32     These are the packages that would be merged, in order:
33
34     Calculating dependencies... done!
35     [ebuild  N     ] dev-libs/libmix-2.05-r6  USE="-static-libs" 0 kB
36     [ebuild  N     ] net-analyzer/netcat-110-r9  USE="crypt ipv6 -static" 0 kB
37
38     Total: 2 packages (2 new), Size of downloads: 0 kB
39     …
40
41 The local Portage cache, read news items, etc. stored outside of
42 `/usr/portage` (e.g. in `/var/cache/edb`, `/var/lib/gentoo/news`, …)
43 will still be local to your client containers, so you'll get
44 promptings for reading the news on both `d1a49abc4b3c` and
45 `187adaf8babd`.
46
47 You can use container volumes even if their container is not running
48 (as above), but it may be useful to leave the container running so you
49 don't remove it up by accident.  For example:
50
51     $ docker run -d --name portage wking/portage /bin/sh -c 'tail -f /usr/portage/profiles/repo_name'
52
53 [VOLUME]: http://docs.docker.io/en/latest/use/builder/#volume
54 [volumes-from]: http://docs.docker.io/en/latest/use/working_with_volumes/#mount-volumes-from-an-existing-container