Merge remote-tracking branch 'remotes/origin/pr/97'
[grml-debootstrap.git] / docker / README.md
1 Purpose
2 -------
3
4 Execute grml-debootstrap inside a docker container.
5 This is useful e.g. for developing new features, reproducing problems and writing tests in a clean and reproducible environment.
6
7 Files
8 -----
9
10 The Dockerfile is controlling the [automated builds at the Docker Hub Registry](https://registry.hub.docker.com/u/mika/grml-debootstrap/).
11
12 The `*.bats` files are test scripts, used for verifying the Debian installations as generated by the `test*.sh` scripts.
13
14 Usage instructions
15 ------------------
16
17 Make sure the docker image generated by the Dockerfile is available on your system:
18
19 ````
20 % docker pull mika/grml-debootstrap
21 ````
22
23 Start a container instance and switch into it via e.g.:
24
25 ````
26 % docker run -it --privileged=true mika/grml-debootstrap
27 ````
28
29 *NOTE:* `--privileged=true` is required for usage with loop devices and mounting proc, sysfs etc inside the container
30
31 *TIP:* add the `--rm` option to the command line to automatically remove the container when it exits
32
33 Use grml-debootstrap inside the container, e.g.:
34
35 * Install Debian inside a VM image:
36
37 ````
38 # grml-debootstrap --vmfile --target /srv/debian.img --password grml --hostname docker [--force]
39 ````
40
41 * Install Debian system in a directory:
42
43 ````
44 # grml-debootstrap --target /srv/debian --password grml --hostname docker [--force]
45 ````
46
47 *TIP:* to speed up the build prepend `eatmydata` in the grml-debootstrap command line
48
49 *TIP:* if you want to have access to the generated Debian systems after exiting the container make sure to share your working directory as `/srv` via adding `-v $PWD:/srv/` to your `docker run` command line
50
51 Usage of test scripts
52 ---------------------
53
54 This directory provides example scripts (`test*.sh`) and tests (`*.bats`) for building and verifying Debian installations, generated via grml-debootstrap.
55 To use them make sure this docker directory is available inside the docker container at /srv:
56
57 ````
58 % docker run -it --privileged=true -v $PWD:/srv/ --rm mika/grml-debootstrap
59 ````
60
61 Then you can simply invoke `/srv/test_dirinstall.sh` or `/srv/test_vminstall.sh`, which will install Debian systems at `/srv/debian` or `/srv/debian.img` respectively and run some tests on the resulting systems.