|
| 1 | +# Docker Containers BKMs |
| 2 | + |
| 3 | +## Docker vs Podman |
| 4 | + |
| 5 | +Docker and Podman are very similar tools, that allow you to manage and run |
| 6 | +container images. Unlike Docker, Podman runs without a daemon, allows you to run |
| 7 | +containers without root permissions, but does not let you build a container from |
| 8 | +source. The command line syntax is mostly identical for Docker and Podman. |
| 9 | +Choose whatever is available on your system. |
| 10 | + |
| 11 | +## SYCL Containers overview |
| 12 | + |
| 13 | +The following containers are publicly available for DPC++ compiler development: |
| 14 | + |
| 15 | +- `ghcr.io/intel/llvm/ubuntu2004_base`: contains basic environment setup for |
| 16 | + building DPC++ compiler from source. |
| 17 | +- `ghcr.io/intel/llvm/ubuntu2004_intel_drivers`: contains everything from base |
| 18 | + container + pre-installed Intel drivers. This image provides two main tags: |
| 19 | + `latest`, that uses latest available drivers, and `stable`, that uses |
| 20 | + recommended drivers. |
| 21 | +- `ghcr.io/intel/llvm/ubuntu2004_nightly`: contains latest successfully built |
| 22 | + nightly build of DPC++ compiler, as well as pre-installed Intel drivers. |
| 23 | + |
| 24 | +## Building a Docker Container from scratch |
| 25 | + |
| 26 | +Docker containers can be build with the following command: |
| 27 | + |
| 28 | +``` |
| 29 | +docker build -f path/to/devops/containers/file.Dockerfile path/to/devops/ |
| 30 | +``` |
| 31 | + |
| 32 | +The `ubuntu2004_preinstalled.Dockerfile` script expects `llvm_sycl.tar.gz` file |
| 33 | +to be present in `devops/` directory. |
| 34 | + |
| 35 | +Containers other than base provide several configurable arguments, most commonly |
| 36 | +used are`base_image` and `base_tag`, that specify base Docker image and its tag. |
| 37 | +You can set additional arguments with `--build-arg ARG=value` argument. |
| 38 | + |
| 39 | +## Running Docker container interactively |
| 40 | + |
| 41 | +The main application of Docker is containerizing services. But it also allows |
| 42 | +you to run containers interactively, so that you can use it as you would use a |
| 43 | +terminal or SSH session. The following command allows you to do that: |
| 44 | + |
| 45 | +``` |
| 46 | +docker run --name <friendly_name> -it --entrypoint /bin/bash <image_name>[:<tag>] |
| 47 | +``` |
| 48 | + |
| 49 | +This command will download an image, if it does not exist locally. If you've |
| 50 | +downloaded an image previously, and you want to update it, use |
| 51 | +`docker pull <image_name>` command. |
| 52 | + |
| 53 | +## Passthrough an Intel GPU to container |
| 54 | + |
| 55 | +Add `--device=/dev/dri` argument to `run` command to passthrough you Intel GPU. |
| 56 | + |
| 57 | +## Passthrough a directory to container |
| 58 | + |
| 59 | +Use `-v path/on/host:path/in/container` argument for `run` command to |
| 60 | +passthrough a host directory or a file. |
| 61 | + |
| 62 | +## Managing downloaded Docker image |
| 63 | + |
| 64 | +List local images: |
| 65 | +``` |
| 66 | +docker image ls |
| 67 | +``` |
| 68 | + |
| 69 | +Remove local image: |
| 70 | +``` |
| 71 | +docker image rm <image_name_or_id> |
| 72 | +``` |
0 commit comments