-
Notifications
You must be signed in to change notification settings - Fork 790
[Doc] Add documentation for Docker images #4778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5e54dd2
[Doc] Add documentation for Docker images
alexbatashev 4093e6a
update for current images
alexbatashev 5ff13fa
Merge remote-tracking branch 'upstream/sycl' into containers_docs
alexbatashev 1a29acb
Apply suggestions from code review
20dc963
rearrange things
alexbatashev 8063875
remove merge conflict leftovers
alexbatashev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
# Docker Containers BKMs | ||
|
||
## Installation | ||
|
||
Follow the [official guide](https://docs.docker.com/engine/install/) for your | ||
OS or distro. | ||
|
||
### Change location of the images on the system | ||
|
||
By default Docker stores images in `/var/lib/docker`, but that can be changed. | ||
|
||
Create a new file called `/etc/docker/daemon.json` and put the following | ||
content: | ||
|
||
``` | ||
{ | ||
"data-root": "/path/to/data/root", | ||
"exec-root": "/path/to/exec/root" | ||
} | ||
``` | ||
|
||
### Running Docker without sudo | ||
|
||
Add your local user to `docker` group to be able to run docker commands without | ||
sudo. | ||
|
||
|
||
### Docker vs Podman | ||
|
||
Docker and Podman are very similar tools, that allow you to manage and run | ||
container images. Unlike Docker, Podman runs without a daemon and allows you | ||
to run containers without root permissions. The command line syntax is mostly | ||
identical for Docker and Podman. Choose whatever is available on your system. | ||
|
||
## SYCL Containers overview | ||
|
||
The following containers are publicly available for DPC++ compiler development: | ||
|
||
- `ghcr.io/intel/llvm/ubuntu2004_base`: contains basic environment setup for | ||
building DPC++ compiler from source. | ||
- `ghcr.io/intel/llvm/ubuntu2004_intel_drivers`: contains everything from the | ||
base container + pre-installed Intel drivers. | ||
- `ghcr.io/intel/llvm/sycl_ubuntu2004_nightly`: contains the latest successfully | ||
built nightly build of DPC++ compiler. The image comes in two flavors: | ||
with pre-installed Intel drivers (`latest`) and without them (`no-drivers`). | ||
|
||
## Running Docker container interactively | ||
|
||
The main application of Docker is containerizing services. But it also allows | ||
you to run containers interactively, so that you can use them as you would use a | ||
terminal or SSH session. The following command allows you to do that: | ||
|
||
``` | ||
docker run --name <friendly_name> -it <image_name>[:<tag>] /bin/bash | ||
``` | ||
|
||
This command will download an image if it does not exist locally. If you've | ||
downloaded an image previously, and you want to update it, use | ||
`docker pull <image_name>` command. | ||
|
||
## Persisting data | ||
|
||
### Persisting data with volumes | ||
|
||
Docker container images are read-only. When container is destroyed, all its data | ||
is lost. To persist data when working with containers (i.e. when upgrading | ||
container version) one can use Docker volumes. | ||
|
||
Creating a volume: | ||
|
||
``` | ||
docker volume create <volume name> | ||
``` | ||
|
||
Listing all volumes: | ||
|
||
``` | ||
docker volume list | ||
``` | ||
|
||
Mounting volume to the container: | ||
|
||
``` | ||
docker run <options> -v <volume_name>:/path/inside/container <image_name> bash | ||
``` | ||
|
||
Deleting a volume: | ||
|
||
``` | ||
docker volume rm <image_name> | ||
``` | ||
|
||
See [official documentation](https://docs.docker.com/storage/volumes/) for more | ||
info. | ||
|
||
### Passthrough a directory to a container | ||
|
||
Use `-v path/on/host:path/in/container` argument for `run` command to | ||
passthrough a host directory or a file. | ||
|
||
## GPU passthrough | ||
|
||
### Intel | ||
|
||
Add `--device=/dev/dri` argument to `run` command to passthrough you Intel GPU. | ||
Make sure you're a member of `video` group to be able to access GPU. | ||
|
||
### AMD | ||
|
||
Follow the [official guide](https://rocmdocs.amd.com/en/latest/ROCm_Virtualization_Containers/ROCm-Virtualization-&-Containers.html). | ||
|
||
### Nvidia | ||
|
||
Follow [these](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html) | ||
instructions. | ||
|
||
## Changing Docker user | ||
|
||
By default all processes inside Docker run as root. Some LLVM or Clang tests | ||
expect your user to be anything but root. You can change the user by specifying | ||
`-u <username or uid>` option. All Docker containers come with user `sycl` | ||
created. | ||
|
||
## Managing downloaded Docker images | ||
|
||
List local images: | ||
``` | ||
docker image ls | ||
``` | ||
|
||
Remove local image: | ||
``` | ||
docker image rm <image_name_or_id> | ||
``` | ||
|
||
## Managing disk usage | ||
|
||
See how much space is taken by docker: | ||
|
||
``` | ||
docker system df | ||
``` | ||
|
||
Cleaning unused data: | ||
|
||
``` | ||
docker system prune | ||
``` | ||
|
||
See [official documentation](https://docs.docker.com/engine/reference/commandline/system_prune/) | ||
for more info. | ||
|
||
## Building a Docker Container from scratch | ||
|
||
Docker containers can be built with the following command: | ||
|
||
``` | ||
docker build -f path/to/devops/containers/file.Dockerfile path/to/devops/ | ||
``` | ||
|
||
The `ubuntu2004_preinstalled.Dockerfile` script expects `llvm_sycl.tar.xz` file | ||
to be present in `devops/` directory. | ||
|
||
Containers other than base provide several configurable arguments, the most | ||
commonly used are `base_image` and `base_tag`, which specify the base Docker | ||
image and its tag. You can set additional arguments with `--build-arg ARG=value` | ||
argument. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bader @vladimirlaz folks, I hope you don't mind