Public Repository

Last pushed: 4 months ago
Short Description
Alpine Linux with MPICH for developing and deploying distributed MPI programs
Full Description


Docker image of Alpine Linux with latest version of MPICH -- portable implementation of Message Passing Interface (MPI) standard.


  • latest / default (Dockerfile) contains MPICH and essential build tools. Intended to be used as development environment for developing MPI programs.


    • MPICH compiler (the version is according to the tag version)
    • build-base package (gcc, g++, make, wget, curl, etc.)
    • default user mpi (sudoer without password)
    • default working directory /project (owned by default user)
  • onbuild (Dockerfile) inherits base image with network setup for cluster. Can be used like base image but intended to be used to build image that contains compiled MPI program in order to deploy to a cluster.
    See Deployment section for cluster setup

To download updated images:

$ docker pull nlknguyen/alpine-mpich
$ docker pull nlknguyen/alpine-mpich:onbuild

The image is available here at DockerHub and is automatically rebuilt by changes on this GitHub repository. This image is intended for developing projects that use MPICH and unlikely to be suitable for developing MPICH itself.


For Development

At the directory of your MPI project, run:

$ docker run --rm -it -v $(pwd):/project nlknguyen/alpine-mpich
  • After downloading the image to the cache in your system for the first time, it will fire up a Docker container based on this image, and, without additional argument, it drops you in an interactive shell (ASH) where you can run mpicc, mpirun, or any software available in the container.
  • Your project directory is mounted to /project directory inside the container so that the programs in the container can have effects on your project directory. This way you can develop your MPI program using any editor in any host OS and use this Docker container to compile and run the MPI program.

Argument explanation:

  • --rm remove the container after the program is finished.
  • -it open an interactive terminal session (see -i -t for details)
  • -v $(pwd):/project volume mount the current directory $(pwd) where your shell is at, to the directory /project inside the container.

Follow general guidelines for using Docker container

To get updated image:

$ docker pull nlknguyen/alpine-mpich

Extending the Image

It is common that you need to install/remove packages, add compiled program, configure network, or any administration task. To do that, create your own Dockerfile and extend from this image. Below is a simple example. See Docker documentation for details.

Example: add packages

Create your own Dockerfile with the content:

FROM nlknguyen/alpine-mpich

RUN sudo apk add --no-cache valgrind gdb

# if you need to run as root
USER root

# run commands as root

# switch back to non-root user

CMD ["/bin/ash"]

then build

$ docker build -t my-custom-image .

Build arguments are available. See this.

to run:

$ docker run --rm -it -v $(pwd):/project my-custom-image

Some environment variables from the image that you can use in your Dockerfile:

  • USER non-root user who is a sudoer without password. Default=mpi
  • WORKDIR main working directory owned by default user. Default=/project

However, these are not intended to be set at Docker run command. They can be set at build time, and their meaningful values stay permanent. For build customization, go to the GitHub page for more details.

For Deployment

See cluster setup instruction

Demo screencast


Feedbacks are always welcome. For general comments, use the comment section at the bottom of this image page on Docker Hub


Use this GitHub repository issues


Suggestions and pull requests are awesome.

License MIT

Copyright © Nikyle Nguyen

Docker Pull Command

Comments (0)