Skip to content

Commit 078b40b

Browse files
author
Kent Knox
committed
Adding dev/* dockerfiles meant to serve as base images
New dockerfiles exist in a subdirectory called /dev. These are meant to serve as base docker images downstream dockerfiles use in FROM statements Fixed stale URL's and fixed up the name of the rocm kernel packages.
1 parent a14fa60 commit 078b40b

10 files changed

+60
-51
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ When working with the ROCm containers, the following are common and useful docke
3232
* Follow the documentation in the [quick start guide](quick-start.md) for a solution to change to the storage driver
3333

3434
#### Saving work in a container
35-
Docker containers are typically ephemeral, and are discarded after closing the container with the '**--rm**' flag to `docker run`. However, there are times when it is desirable to close a container that has arbitrary work in it, and serialize it back into a docker image. This may be to to create a checkpoint in a long and complicated series of instructions, or it may be desired to share the image with others through a docker registry, such as docker hub.
35+
Docker containers are typically ephemeral, and are discarded after closing the container with the '**--rm**' flag to `docker run`. However, there are times when it is desirable to close a container that has arbitrary work in it, and serialize it back into a docker image. This may be to to create a checkpoint in a long and complicated series of instructions, or it may be desired to share the image with others through a docker registry, such as docker hub.
3636

3737
```bash
3838
sudo docker ps -a # Find container of interest
@@ -49,15 +49,15 @@ An [apt-get repository](https://github.com/RadeonOpenCompute/ROCm/wiki#installin
4949

5050
## Building images
5151
There are two ways to install rocm components:
52-
1. install from the rocm apt/rpm repository (packages.amd.com)
52+
1. install from the rocm apt/rpm repository (repo.radeon.com)
5353
2. build the components from source and run install scripts
5454

5555
The first method produces docker images with the smallest footprint and best building speed. The footprint is smaller because no developer tools need to be installed in the image, an the images build speed is fastest because typically downloading binaries is much faster than downloading source and then invoking a build process. Of course, building components allows much greater flexibility on install location and the ability to step through the source with debug builds. ROCm-docker supports making images either way, and depends on the flags passed to the setup script.
5656

5757
The setup script included in this repository is provides some flexibility to how docker containers are constructed. Unfortunately, Dockerfiles do not have a preprocessor or template language, so typically build instructions are hardcoded. However, the setup script allows us to write a primitive 'template', and after running it instantiates baked dockerfiles with environment variables substituted in. For instance, if you wish to build release images and debug images, first run the setup script to generate release dockerfiles and build the images. Then, run the setup script again and specify debug dockerfiles and build new images. The docker images should generate unique image names and not conflict with each other.
5858

5959
## setup.sh
60-
Currently, the setup.sh scripts checks to make sure that it is running on an **Ubuntu system**, as it makes a few assumptions about the availability of tools and file locations. If running rocm on a Fedora machine, inspect the source of setup.sh and issue the appropriate commands manually. There are a few parameters to setup.sh of a generic nature that affects all images built after running. If no parameters are given, built images will be based off of Ubuntu 16.04 with rocm components installed from debians downloaded from packages.amd.com. Supported parameters can be queried with `./setup --help`.
60+
Currently, the setup.sh scripts checks to make sure that it is running on an **Ubuntu system**, as it makes a few assumptions about the availability of tools and file locations. If running rocm on a Fedora machine, inspect the source of setup.sh and issue the appropriate commands manually. There are a few parameters to setup.sh of a generic nature that affects all images built after running. If no parameters are given, built images will be based off of Ubuntu 16.04 with rocm components installed from debians downloaded from repo.radeon.com. Supported parameters can be queried with `./setup --help`.
6161

6262
| setup.sh parameters | parameter [default]| description |
6363
|-----|-----|-----|
@@ -75,10 +75,10 @@ The following parameters are specific to building containers that compile rocm c
7575
`./setup` generates finalized Dockerfiles from textual template files ending with the *.template* suffix. Each sub-directory of this repository corresponds to a docker 'build context' responsible for a software layer in the ROCm stack. After running the script, each directory contains generated dockerfiles for building images from debians and from source.
7676

7777
### Docker compose
78-
`./setup` prepares an environment to be controlled with [Docker Compose](https://docs.docker.com/compose/). While docker-compose is not necessary for proper operation, it is highly recommended. setup.sh does provide a flag to simplify the installation of this tool. Docker-compose coordinates the relationships between the various ROCm software layers, and it remembers flags that should be passed to docker to expose devices and import volumes.
78+
`./setup` prepares an environment to be controlled with [Docker Compose](https://docs.docker.com/compose/). While docker-compose is not necessary for proper operation, it is highly recommended. setup.sh does provide a flag to simplify the installation of this tool. Docker-compose coordinates the relationships between the various ROCm software layers, and it remembers flags that should be passed to docker to expose devices and import volumes.
7979

8080
#### Example of using docker-compose
81-
docker-compose.yml provides services that build and run containers. YAML is structured data, so it's easy to modify and extend. The *setup.sh* script generates a *.env* file that docker-compose reads to satisfy the definitions of the variables in the .yml file.
81+
docker-compose.yml provides services that build and run containers. YAML is structured data, so it's easy to modify and extend. The *setup.sh* script generates a *.env* file that docker-compose reads to satisfy the definitions of the variables in the .yml file.
8282
* `docker-compose run --rm rocm` -- Run container using rocm packages
8383
* `docker-compose run --rm rocm-from-src` -- Run container with rocm built from source
8484

@@ -91,7 +91,7 @@ docker-compose.yml provides services that build and run containers. YAML is str
9191
| rocm | application service defined in **docker-compose.yml** |
9292

9393
### rocm-user has root privileges by default
94-
The dockerfile that serves as a 'terminal' creates a non-root user called **rocm-user**. This container is meant to serve as a development environment (therefore `apt-get` is likely needed), the user has been added to the linux sudo group. Since it is somewhat difficult to set and change passwords in a container (often requiring a rebuild), the password prompt has been disabled for the sudo group. While this is convenient for development to be able `sudo apt-get install` packages, it does imply *lower security* in the container.
94+
The dockerfile that serves as a 'terminal' creates a non-root user called **rocm-user**. This container is meant to serve as a development environment (therefore `apt-get` is likely needed), the user has been added to the linux sudo group. Since it is somewhat difficult to set and change passwords in a container (often requiring a rebuild), the password prompt has been disabled for the sudo group. While this is convenient for development to be able `sudo apt-get install` packages, it does imply *lower security* in the container.
9595

9696
To increase container security:
9797

dev/Dockerfile-fedora-24

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This dockerfile is meant to serve as a rocm base image. It registers the dnf rocm package repository, and
2+
# installs the rocm-dev package.
3+
4+
FROM fedora:24
5+
LABEL maintainer=kent.knox@amd
6+
7+
# Register the ROCM package repository, and install rocm-dev package
8+
RUN dnf -y update \
9+
&& printf "[remote]\nname=ROCm Repo\nbaseurl=http://repo.radeon.com/rocm/yum/rpm/\nenabled=1\ngpgcheck=0\n" | tee /etc/yum.repos.d/rocm.repo \
10+
&& dnf -y install \
11+
rocm-dev \
12+
&& dnf -y clean all

dev/Dockerfile-ubuntu-16.04

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This dockerfile is meant to serve as a rocm base image. It registers the debian rocm package repository, and
2+
# installs the rocm-dev package.
3+
4+
FROM ubuntu:16.04
5+
LABEL maintainer=kent.knox@amd
6+
7+
# Register the ROCM package repository, and install rocm-dev package
8+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl \
9+
&& curl -sL http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | apt-key add - \
10+
&& printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main" | tee /etc/apt/sources.list.d/rocm.list \
11+
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12+
rocm-dev \
13+
&& apt-get clean \
14+
&& rm -rf /var/lib/apt/lists/*

docker-compose.yml

+16-32
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
version: '2.1'
22

3-
# Manually create these data volumes on the command line like so:
4-
# docker volume create --name cmake-x.x.x
5-
#
6-
# In order to use the home volume, there appears to be an initialization bug
7-
# with named volumes. I was able to get around it by explicitely initializing
8-
# docker run -it --rm -v client-home:/home rocm/jenkins-client bash -l
9-
#
10-
# The etc shared volume is necessary to preserve passwd and supporting files
11-
# when rebuilding the image. I hope in the future a better way can be found to
12-
# preserve user and password information than saving the entire /etc
13-
volumes:
14-
hcc-lc:
15-
external:
16-
name: hcc-lc-${HCC_VERSION}
17-
hip:
18-
external:
19-
name: hip-${HCC_VERSION}
203

214
services:
225
# The following are images built from debians downloaded from a package repository
@@ -74,21 +57,6 @@ services:
7457
dockerfile: ${hcc_lc_src_dockerfile}
7558
image: ${hcc_lc_image_name_src}
7659
container_name: hcc-lc-src
77-
volumes:
78-
- hcc-lc:${hcc_lc_volume}
79-
- hip:/opt/rocm/hip
80-
81-
# hcc-hsail:
82-
# depends_on:
83-
# - rocr
84-
# build:
85-
# context: ./hcc-hsail
86-
# dockerfile: Dockerfile
87-
# image: ${hcc_hsail_name}
88-
# container_name: hcc-hsail
89-
# entrypoint: /bin/true
90-
# volumes:
91-
# - ${hcc_hsail_volume}
9260

9361
# The following defines application containers, which depend on the data-only
9462
# containers defined above to provide their software layers
@@ -117,3 +85,19 @@ services:
11785
- rocr-src:ro
11886
- hcc-lc-src:ro
11987
# - hcc-hsail-src:ro
88+
89+
dev-ubuntu:
90+
build:
91+
context: ./dev
92+
dockerfile: Dockerfile-ubuntu-16.04
93+
devices:
94+
- "/dev/kfd"
95+
image: rocm/dev-ubuntu-16.04
96+
97+
dev-fedora:
98+
build:
99+
context: ./dev
100+
dockerfile: Dockerfile-fedora-24
101+
devices:
102+
- "/dev/kfd"
103+
image: rocm/dev-fedora-24

hcc-hsail/hcc-hsail-deb-dockerfile.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
FROM ${rocr_name}
88
MAINTAINER Kent Knox <kent.knox@amd>
99

10-
# Following assumes that the apt-get update is already set up to pull from packages.amd.com in base image
10+
# Following assumes that the apt-get update is already set up to pull from repo.radeon.com in base image
1111
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
1212
hsa-ext-rocr-dev \
1313
hcc_hsail && \

hcc-lc/hcc-lc-deb-dockerfile.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
FROM ${rocr_image_name_deb}
88
MAINTAINER Kent Knox <kent.knox@amd>
99

10-
# Following assumes that the apt-get update is already set up to pull from packages.amd.com in base image
10+
# Following assumes that the apt-get update is already set up to pull from repo.radeon.com in base image
1111
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
1212
hcc_lc && \
1313
apt-get clean && \

quick-start.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
The following instructions assume a fresh/blank machine to be prepared for the ROCm + Docker environment; no additional software has been installed other than the typical stock package updating.
44

5-
It is my recommendation to install the rocm kernel first. Depending on how distribution release cycles lines up, the rocm kernel is often newer than the stock kernel shipping in most linux distributions. The newer kernel often supports newer AMD hardware better, and stock video resolutions and hardware acceleration performance are typically improved. As of the time of this writing, ROCm officially supports Ubuntu and Fedora Linux distributions. The following asciicast demonstrates updating the kernel on Ubuntu 14.04. More detailed instructions can be found on the Radeon Open Compute website:
5+
It is recommended to install the rocm kernel first. Depending on how distribution release cycles lines up, the rocm kernel is often newer than the stock kernel shipping in most linux distributions. The ROCm kernel often supports newer AMD hardware better, and stock video resolutions and hardware acceleration performance are typically improved. As of the time of this writing, ROCm officially supports Ubuntu and Fedora Linux distributions. The following asciicast demonstrates updating the kernel on Ubuntu 14.04. More detailed instructions can be found on the Radeon Open Compute website:
66
* [Installing ROCK kernel](https://github.com/RadeonOpenCompute/ROCm#debian-repository---apt-get) on Ubuntu
77

88
### Step 1: Install rocm-kernel
9-
[![Install rocm-kernel](https://asciinema.org/a/cv0r34re9hp9g5hoja8vyh803.png)](https://asciinema.org/a/cv0r34re9hp9g5hoja8vyh803)
9+
The following is a sequence of commands to type (or cut-n-paste) into a terminal. Where `<<<tab-complete>>>` is used in the sequence below, it is recommended to complete the string with shell tab completion to auto-complete the latest available rocm kernel:
1010

1111
```bash
12-
wget -qO - http://packages.amd.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
13-
sudo sh -c 'echo deb [arch=amd64] http://packages.amd.com/rocm/apt/debian/ trusty main \
14-
> /etc/apt/sources.list.d/rocm.list'
15-
sudo apt-get update && sudo apt-get install rocm-kernel
12+
wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
13+
echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main | sudo tee /etc/apt/sources.list.d/rocm.list
14+
sudo apt-get update && sudo apt-get install compute-firmware linux-headers-4.11.0-kfd-<<<tab-complete>>> linux-image-4.11.0-kfd-<<<tab-complete>>>
1615
```
1716
Make sure to reboot the machine after installing the ROCm kernel package to force the new kernel to load on reboot. You can verify the ROCm kernel is loaded by typing the following command at a prompt:
1817

rocr/rocr-deb-dockerfile.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
FROM ${roct_image_name_deb}
88
MAINTAINER Kent Knox <kent.knox@amd>
99

10-
# Following assumes that the apt-get update is already set up to pull from packages.amd.com in base image
10+
# Following assumes that the apt-get update is already set up to pull from repo.radeon.com in base image
1111
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
1212
hsa-rocr-dev && \
1313
apt-get clean && \

rocr/rocr-src-dockerfile.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ MAINTAINER Kent Knox <kent.knox@amd>
1111
# HSAIL based tools (hcc-hsail) need the finalizer libraries, which are closed source and not provided on github
1212
# Hopefully, this can be removed in the future when dependencies on closed source blobs are removed
1313
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl && \
14-
curl -sL http://packages.amd.com/rocm/apt/debian/rocm.gpg.key | apt-key add - && \
15-
sh -c 'echo deb [arch=amd64] http://packages.amd.com/rocm/apt/debian/ trusty main > /etc/apt/sources.list.d/rocm.list' && \
14+
curl -sL http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | apt-key add - && \
15+
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ trusty main > /etc/apt/sources.list.d/rocm.list' && \
1616
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
1717
build-essential \
1818
libc6-dev-i386 \

roct/roct-thunk-deb-dockerfile.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ MAINTAINER Kent Knox <kent.knox@amd>
1010

1111
# Initialize the image we are working with
1212
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y curl && \
13-
curl -sL http://packages.amd.com/rocm/apt/debian/rocm.gpg.key | apt-key add - && \
14-
sh -c 'echo deb [arch=amd64] http://packages.amd.com/rocm/apt/debian/ ${target_distrib_codename} main > /etc/apt/sources.list.d/rocm.list' && \
13+
curl -sL http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | apt-key add - && \
14+
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ ${target_distrib_codename} main > /etc/apt/sources.list.d/rocm.list' && \
1515
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
1616
hsakmt-roct-dev && \
1717
apt-get clean && \

0 commit comments

Comments
 (0)