DirectorySecurity AdvisoriesPricing
Sign inTry Starter for free
Directory
openmpi logo

openmpi

packaged by Chainguard

Last changed
Start with 5 free container images

Catalog Starter gives your team 5 production-grade container images, free forever, with no contract or sales call. Sign up with your work email.

Try Starter for free
Chainguard HarnessHack your app with frontier AI

Chainguard Harness uses frontier models from Anthropic, OpenAI, and Google to attack a copy of your app built on openmpi. It finds exploitable, validated issues that SAST and DAST tools aren't built to find.

Tags
Overview
Comparison
Provenance
Specifications
SBOM
Vulnerabilities
Advisories

Chainguard Container for openmpi

Open MPI is an open source Message Passing Interface implementation for running parallel programs across one or more compute nodes.

Chainguard Containers are regularly-updated, secure-by-default container images.

Download this Container Image

For those with access, this container image is available on cgr.dev:

docker pull cgr.dev/ORGANIZATION/openmpi:latest

Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.

Compatibility Notes

The Chainguard openmpi image is comparable to the upstream mcr.microsoft.com/azureml/openmpi5.0-ubuntu24.04 image, the Azure Machine Learning base image for MPI workloads. Open MPI is an open source implementation of the Message Passing Interface (MPI) standard, written in C and licensed under a BSD-3-Clause-style license.

Like the upstream image, this image:

  • Runs as root with /bin/bash as the default command. It sets the same environment variables: PATH, LANG, LC_ALL, DEBIAN_FRONTEND, SVDIR and WORKER_TIMEOUT.
  • Provides the Open MPI tools in /usr/local/openmpi/bin, first on PATH. Its configuration files, headers and libraries are in /usr/local/openmpi/etc, /usr/local/openmpi/include and /usr/local/openmpi/lib. These paths link to the Open MPI, PRRTE, PMIx, hwloc and libevent packages, which are installed under /usr.
  • Includes conda at /opt/miniconda, so conda env create, conda run and conda activate work as they do upstream. For conda activate, first run source /opt/miniconda/etc/profile.d/conda.sh.
  • Includes the OpenSSH client and server, so mpirun can start ranks on other hosts over ssh, with --host or a hostfile.
  • Includes GCC and G++, make, git, curl, wget and the common command-line utilities.
  • Includes the Azure Machine Learning inference runtime in /var/runit: runit services for the inference server (gunicorn), nginx and rsyslog. Nothing in the image starts these services. Azure Machine Learning starts them with runsvdir /var/runit when it serves an online endpoint from an environment built on this image.

Differences from the upstream image:

  • The image is built on Chainguard OS rather than Ubuntu, so it has no apt. /bin/sh is Bash rather than Dash.
  • The Open MPI release is newer, from the same 5.0 series, and has the same libmpi.so.40 library. It uses the system PRRTE, PMIx, hwloc and libevent packages rather than bundled copies. /usr/local/openmpi/include and /usr/local/openmpi/lib have the PRRTE, PMIx and hwloc headers and development libraries, but not libevent's.
  • GCC, and so mpicc, compiles C as C23 (-std=gnu23), whereas the upstream image's GCC defaults to C17. To build older C code that doesn't compile as C23, such as code that defines its own bool, add -std=gnu17. This GCC also rejects implicit function declarations, implicit int and incompatible pointer types, which the upstream image's GCC only warns about; add -fpermissive to build code that relies on them.
  • The /opt/miniconda base environment is the image's Python 3.12, the same Python version as upstream's Miniconda, rather than a Miniconda install.
  • conda defaults to the conda-forge channel. The upstream image defaults to Anaconda's defaults channel and accepts Anaconda's terms of service in the image. To use that channel, name it in your conda file or on the command line.
  • The image ships no SSH host keys. The upstream image ships the same host keys in every container. Generate keys before you start sshd, as the example below does.
  • The image doesn't declare exposed ports. The upstream image exposes ports 5001, 8883 and 8888, but only 5001 is in use: nginx listens on it once the runit services start. Publish the ports you need with -p.
  • Packages that nothing in the upstream image uses are not included. These are libunwind8 and libxml++2.6, and the services Ubuntu installs alongside rsyslog and runit, such as systemd, cron and logrotate.

Getting Started

Print the Open MPI version. Like the upstream image, this image runs as root, and mpirun refuses to start as root unless you pass --allow-run-as-root:

docker run --rm cgr.dev/ORGANIZATION/openmpi:latest mpirun --allow-run-as-root --version

Create a simple MPI program in the current directory:

cat > mpi_hello.c <<'EOF'
#include <mpi.h>
#include <stdio.h>
int main(void) {
    int rank, size;
    MPI_Init(NULL, NULL);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    printf("Hello from rank %d of %d\n", rank, size);
    MPI_Finalize();
    return 0;
}
EOF

Compile it with mpicc and run it across four ranks inside a single container. Running as your own user ID keeps the output binary writable on the bind mount, and a non-root user doesn't need --allow-run-as-root:

docker run --rm -u "$(id -u):$(id -g)" -v "$PWD:/work" -w /work \
  cgr.dev/ORGANIZATION/openmpi:latest mpicc -o mpi_hello mpi_hello.c

docker run --rm -u "$(id -u):$(id -g)" -v "$PWD:/work" -w /work \
  cgr.dev/ORGANIZATION/openmpi:latest mpirun --oversubscribe -np 4 ./mpi_hello

Run across two nodes over SSH

mpirun starts ranks on other hosts over ssh. This example runs two containers as nodes on a Docker network and starts two ranks on each of them from a third container. A shared volume holds the program and an SSH key pair. The keys are ECDSA, so the same steps work on the openmpi-fips image.

Create the network and the volume, then build the program and the key pair into the volume:

docker network create mpi-net
docker volume create mpi-work

docker run --rm -i -v mpi-work:/work cgr.dev/ORGANIZATION/openmpi:latest bash -ec '
  cd /work
  ssh-keygen -q -t ecdsa -N "" -f id_ecdsa
  cp id_ecdsa.pub authorized_keys
  mpicc -o mpi_hello -x c -' <mpi_hello.c

Start the two nodes. Each one trusts the public key, generates a host key and runs sshd:

for node in node1 node2; do
  docker run -d --name "$node" --hostname "$node" --network mpi-net \
    -v mpi-work:/work cgr.dev/ORGANIZATION/openmpi:latest bash -ec '
      install -d -m 700 /root/.ssh
      install -m 600 /work/authorized_keys /root/.ssh/authorized_keys
      ssh-keygen -q -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key
      exec /usr/sbin/sshd -D -e'
done

Start four ranks, two on each node. The program doesn't read standard input, so --stdin none stops mpirun from forwarding it to rank 0:

docker run --rm --network mpi-net -v mpi-work:/work \
  cgr.dev/ORGANIZATION/openmpi:latest bash -ec '
    install -d -m 700 /root/.ssh
    install -m 600 /work/id_ecdsa /root/.ssh/id_ecdsa
    printf "Host node1 node2\n  StrictHostKeyChecking no\n  UserKnownHostsFile /dev/null\n  LogLevel ERROR\n" >/root/.ssh/config
    mpirun --allow-run-as-root --stdin none --host node1:2,node2:2 -np 4 /work/mpi_hello'

Each rank prints one line, in any order:

Hello from rank 0 of 4
Hello from rank 1 of 4
Hello from rank 2 of 4
Hello from rank 3 of 4

Serve an Azure Machine Learning scoring script

To serve an online endpoint from an environment built on this image, Azure Machine Learning creates a conda environment from the deployment's conda file. It then starts the runit services with conda run -n <environment> runsvdir /var/runit. You can run the same steps locally.

Create a scoring script and a conda file that installs the inference server:

mkdir -p azureml-app

cat > azureml-app/score.py <<'EOF'
import json

def init():
    print("scoring script initialized")

def run(raw_data):
    return {"sum": sum(json.loads(raw_data)["data"])}
EOF

cat > azureml-app/conda.yaml <<'EOF'
name: amlenv
channels:
  - conda-forge
dependencies:
  - python=3.12
  - pip
  - pip:
      - azureml-inference-server-http
EOF

Start the container. It creates the environment and then starts the services:

docker run -d --name azureml-endpoint -p 5001:5001 \
  -e AZUREML_ENTRY_SCRIPT=score.py \
  -v "$PWD/azureml-app:/var/azureml-app:ro" \
  cgr.dev/ORGANIZATION/openmpi:latest bash -ec '
    conda env create -n amlenv --file /var/azureml-app/conda.yaml
    exec conda run --no-capture-output -n amlenv runsvdir /var/runit'

Creating the environment takes a few minutes. Once curl http://localhost:5001/ responds, send a scoring request:

curl -X POST http://localhost:5001/score \
  -H 'Content-Type: application/json' -d '{"data": [1, 2, 3]}'

The inference server returns the scoring script's result:

{"sum": 6}

Kubernetes

The following one-shot Job compiles and runs the same program in a single pod. It runs the image as the non-root user 65532 under the restricted Pod Security Standard. First, store the source file from the previous steps in a ConfigMap:

kubectl create configmap openmpi-hello-src --from-file=mpi_hello.c

Create the manifest as openmpi-hello.yaml. The Job mounts the ConfigMap at /src and builds the program in /tmp:

cat > openmpi-hello.yaml <<'YAML'
apiVersion: batch/v1
kind: Job
metadata:
  name: openmpi-hello
spec:
  backoffLimit: 0
  template:
    spec:
      restartPolicy: Never
      securityContext:
        runAsNonRoot: true
        runAsUser: 65532
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: openmpi
          image: cgr.dev/ORGANIZATION/openmpi:latest
          workingDir: /tmp
          command: ["/bin/bash", "-c"]
          args:
            - mpicc -o mpi_hello /src/mpi_hello.c && mpirun --oversubscribe -np 4 ./mpi_hello
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop: ["ALL"]
          volumeMounts:
            - name: src
              mountPath: /src
              readOnly: true
      volumes:
        - name: src
          configMap:
            name: openmpi-hello-src
YAML

Apply it and read the output:

kubectl apply -f openmpi-hello.yaml
kubectl wait --for=condition=complete job/openmpi-hello --timeout=120s
kubectl logs job/openmpi-hello

Configuration

  • The image sets the same environment variables as the upstream image:
    • PATH=/usr/local/openmpi/bin:/opt/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    • LANG=C.UTF-8 and LC_ALL=C.UTF-8
    • DEBIAN_FRONTEND=noninteractive
    • SVDIR=/var/runit and WORKER_TIMEOUT=300, which configure the runit services
  • The image runs as root by default, so pass --allow-run-as-root to mpirun, as on the upstream image. To run as another user instead, pass -u to docker run, or set runAsUser in Kubernetes. Any mounted directory that your MPI application writes to must be writable by that user.
  • Open MPI runtime parameters can be set with OMPI_MCA_* environment variables, --mca flags to mpirun, or /usr/local/openmpi/etc/openmpi-mca-params.conf.
  • sshd needs host keys. The image ships none, so generate them, or mount your own into /etc/ssh, before you start it.

Documentation and Resources

What are Chainguard Containers?

Chainguard's free tier of Starter container images are built with Wolfi, our minimal Linux undistro.

All other Chainguard Containers are built with Chainguard OS, Chainguard's minimal Linux operating system designed to produce container images that meet the requirements of a more secure software supply chain.

The main features of Chainguard Containers include:

For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a development, or -dev, variant.

In all other cases, including Chainguard Containers tagged as :latest or with a specific version number, the container images include only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager.

Although the -dev container image variants have similar security features as their more minimal versions, they include additional software that is typically not necessary in production environments. We recommend using multi-stage builds to copy artifacts from the -dev variant into a more minimal production image.

Need additional packages?

To improve security, Chainguard Containers include only essential dependencies. Need more packages? Chainguard customers can use Custom Assembly to add packages, either through the Console, chainctl, or API.

To use Custom Assembly in the Chainguard Console: navigate to the image you'd like to customize in your Organization's list of images, and click on the Customize image button at the top of the page.

Learn More

Refer to our Chainguard Containers documentation on Chainguard Academy. Chainguard also offers VMs and Libraries — contact us for access.

Trademarks

This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.

Licenses

Chainguard's container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag of this image:

  • ( Artistic-1.0-Perl

  • ( GPL-2.0-or-later

  • (Apache-2.0

  • (MPL-2.0

  • Apache-2.0

  • Artistic-1.0-Perl

  • BSD-1-Clause

For a complete list of licenses, please refer to this Image's SBOM.

Software license agreement

Compliance

Chainguard Containers are SLSA Level 3 compliant with detailed metadata and documentation about how it was built. We generate build provenance and a Software Bill of Materials (SBOM) for each release, with complete visibility into the software supply chain.

SLSA compliance at Chainguard

This image helps reduce time and effort in establishing PCI DSS 4.0 compliance with low-to-no CVEs.

PCI DSS at Chainguard

A FIPS validated version of this image is available for FedRAMP compliance. STIG is included with FIPS image.


Related images
openmpi-fips logoFIPS

openmpi-fips


Category
Application

The trusted source for open source

Talk to an expert
PrivacyTerms

Product

Chainguard ContainersChainguard LibrariesChainguard VMsChainguard OS PackagesChainguard ActionsChainguard Agent SkillsIntegrationsPricing
© 2026 Chainguard, Inc. All Rights Reserved.
Chainguard® and the Chainguard logo are registered trademarks of Chainguard, Inc. in the United States and/or other countries.
The other respective trademarks mentioned on this page are owned by the respective companies and use of them does not imply any affiliation or endorsement.