Skip to content

Installation of pfd‐parallel via downloading a Docker image

qun edited this page Sep 12, 2024 · 5 revisions

(Work In Progress)

Sometimes it is also useful to install pfd-parallel inside a Docker images.

Step 0: Install Docker

To get started, make sure Docker is installed on your system. Follow the official installation guide for your OS: Docker Install Guide.

Setp 1: Basic setup

After Docker is installed and enabled, you can pull the pull the official Ubuntu 20.04 image by typing the following command in your terminal:

sudo docker pull ubuntu:20.04

Once it is done, you can see the local images by

docker images
#REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
#ubuntu        20.04     9df6d6105df2   4 weeks ago     72.8MB

After that, you can start a container of this image by the following command:

sudo docker run -it ubuntu:20.04

The "-it" stands for interactively starting a pseudo-terminal. Once inside the Ubuntu container, you can add user, modify the permission or install software as if you were on a brand-new Ubuntu system. For example, you can run:

apt update
apt install <your-software>

For practical use, we suggest operating under a normal user with sudo privilege. It can be done by adduser <username>. You also need to set the password for the root user, since it is the first time to login. This can be done by passwd root.

You can start another terminal outside the docker container, and type docker ps -a to check the information for your container. Each container will have a unique container ID.

After you finished the change in the container, you can type exit or just press Ctrl+D to quit the container and get back to the original machine. At this point, the image has not been changed and saved, unless you type:

sudo docker commit <container_id> ubuntu-for-pfd:latest

in this line the <container_id> can be seen by docker ps -a outside the container. ubuntu-for-pfd is the name of the image, and latest is the tag of the image. This line will save all the change you made in the container to a new image namedubuntu-for-pfd:latest.

Step 2: Install pfd-parallel inside the docker.

Since we already set up a normal user in the image ubuntu-for-pfd:latest, we can login in as this <username> rather than root, by the following manner:

sudo docker run -it --hostname <hostname> --user <username> ubuntu-for-pfd:latest

We also specify a hostname by the option --hostname for the container, this would be helpful to set up the ssh service. After that one can install first spack and then pfd-parallel as instructed in the this page.

After the installation finished, we can exit the container and remember to commit the changes:

sudo docker commit <container_id> ubuntu-for-pfd:latest

See also: How to use pfd-parallel via Docker.