1Docker Containers
2=================
3
4These Docker containers should make it possible to build Xen in
5any of the available environments on any system that supports
6running Docker. They are organized by distro and tagged with
7the version of that distro. They are available from the GitLab
8Container Registry under the Xen project at the [registry] and
9can be pulled with Docker from the following path:
10
11```
12docker pull registry.gitlab.com/xen-project/xen/DISTRO:VERSION
13```
14
15To see the list of available containers run `make` in this
16directory. You will have to replace the `/` with a `:` to use
17them.
18
19Building Xen
20------------
21
22From the top level of the source tree it should be possible to
23run the following:
24
25```
26./automation/scripts/containerize make
27```
28
29Which will cause the top level `make` to execute within the default
30container, which is currently defined as Debian Stretch. Any arguments
31specified to the script will be executed within the container from
32the default shell.
33
34There are several environment variables which the containerize script
35understands.
36
37- DOCKED_CMD: Whether to use docker or podman for running the containers.
38  podman can be used as a regular user (rootless podman), but for that
39  to work, /etc/subuid and /etc/subgid needs to containe the proper
40  entries, for such user.
41  docker is the default, for running with podman, do:
42
43  ```
44  DOCKER_CMD=podman ./automation/scripts/containerize make
45  ```
46
47- CONTAINER: This overrides the container to use. For CentOS 7.2, use:
48
49  ```
50  CONTAINER=centos72 ./automation/scripts/containerize make
51  ```
52
53- CONTAINER_PATH: This overrides the path that will be available under the
54  `/build` directory in the container, which is the default path.
55
56  ```
57  CONTAINER_PATH=/some/other/path ./automation/scripts/containerize ls
58  ```
59
60- CONTAINER_ARGS: Allows you to pass extra arguments to Docker
61  when starting the container.
62
63- CONTAINER_UID0: This specifies whether root is used inside the container.
64
65- CONTAINER_NO_PULL: If set to 1, the script will not pull from docker hub.
66  This is useful when testing container locally.
67
68- XEN_CONFIG_EXPERT: If this is defined in your shell it will be
69  automatically passed through to the container.
70
71If your docker host has Linux kernel > 4.11, and you want to use containers
72that run old glibc (for example, CentOS 6 or SLES11SP4), you may need to add
73
74```
75vsyscall=emulate
76```
77
78to the host kernel command line. That enables a legacy interface that is used
79by old glibc.
80
81
82Building a container
83--------------------
84
85There is a makefile to make this process easier. You should be
86able to run `make DISTRO/VERSION` to have Docker build the container
87for you. If you define the `PUSH` environment variable when running the
88former `make` command, it will push the container to the [registry] if
89you have access to do so and have your Docker logged into the registry.
90
91To login you must run `docker login registry.gitlab.com`. For more
92information see the [registry help].
93
94[registry]: https://gitlab.com/xen-project/xen/container_registry
95[registry help]: https://gitlab.com/help/user/project/container_registry
96