cann
CANN (Compute Architecture for Neural Networks) is Huawei Ascend’s runtime and toolkit layer. The cann/ directory holds versioned Dockerfiles that layer developer tooling on top of published CANN base images, covering both local root images and ModelArts ma-user variants.
Representative files:
| Dockerfile | Role |
|---|---|
8.3.RC1-base.Dockerfile |
Local development base with a prebuilt LLVM 19.1.7 toolchain under /opt/llvm, monitoring/debug utilities, SSH, and entrypoint.sh |
8.3.RC1.alpha003-modelarts.Dockerfile |
ModelArts image with PyTorch 2.x and torch-npu |
8.2.RC1.alpha003-modelarts.Dockerfile |
ModelArts image with a scientific Python stack on CANN 8.2 |
8.2.RC1.alpha002-modelarts.Dockerfile |
Older ModelArts line with Miniconda (Python 3.10) |
8.1.RC1.beta1-modelarts.Dockerfile |
Legacy ModelArts line retained for compatibility |
Newer lines (8.5.x, 9.0.0, 9.0.0-beta.2, 9.1.0-master, and device- or distro-specific variants such as 910b / 910c / A3 and Ubuntu / openEuler) follow the same pattern: pin a CANN base tag in the filename, then add packages and user setup needed for that target. Browse cann/ for the full set.
The 8.3 RC1 base image is still a useful reference for a “batteries included” local toolchain. It expects a prebuilt archive at build time (clang+llvm-19.1.7-aarch64-linux-gnu.tar.xz in the build context), installs it to /opt/llvm, and exports LLVM_INSTALL_PREFIX, CC, and CXX accordingly. Python packages commonly pinned in that line include NumPy, SciPy, pybind11, pytest, and related build helpers. entrypoint.sh sources Ascend environment scripts and can configure in-container SSH when keys are supplied.
Older tags are kept mainly for reproducing historical environments and dependency pins.
Master channel
Rolling base images built from the master (bleeding-edge) channel of the Huawei Ascend CANN toolkit, for Ubuntu 22.04/24.04 and openEuler 22.03/24.03. Each Dockerfile is a single stage: it installs a C/C++ toolchain, builds CPython 3.11.15 from source under /usr/local/python3.11.15, then installs the CANN toolkit and ops packages supplied as build arguments.
CANN_TOOLKIT_URL and CANN_OPS_URL are required and must point at matching .run installers from the same snapshot on the Ascend CANN run-package mirror, typically under master/. Build the Ubuntu variant with:
docker build \
-f cann/master/ubuntu22.04/Dockerfile \
--build-arg CANN_TOOLKIT_URL='https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master/<snapshot>/Ascend-cann-toolkit_<version>_linux-<arch>.run' \
--build-arg CANN_OPS_URL='https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master/<snapshot>/Ascend-cann-910b-ops_<version>_linux-<arch>.run' \
-t cann:master-ubuntu22.04 \
.
Use the matching directory for the other variants:
cann/master/ubuntu22.04/Dockerfilecann/master/ubuntu24.04/Dockerfilecann/master/openeuler22.03/Dockerfilecann/master/openeuler24.03/Dockerfile
The images run as root. A HwHiAiUser account is still created because the CANN installers expect it, not because the container runs as a different user. Interactive shells load the CANN environment automatically by sourcing /usr/local/Ascend/cann/set_env.sh from ~/.bashrc; source it yourself for non-interactive commands.
cann-master-weekly.yml rebuilds all four variants every Tuesday against the latest CANN master snapshot and publishes rolling multi-arch tags such as cann:master-910b-ubuntu24.04.