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