Skip to content

Commit 20732d5

Browse files
committed
add Dockerfile fo centos8
1 parent 8e8ac08 commit 20732d5

2 files changed

Lines changed: 96 additions & 15 deletions

File tree

docker/Dockerfile_centos

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# command to build: docker build --rm -f Dockerfile_centos -t qingfengxia/ppp-centos . --no-cache
2+
# docker push qingfengxia/ppp-centos:latest
3+
# Use multi-stage builds: https://docs.docker.com/develop/develop-images/multistage-build/
4+
# rebuild on top of local image (instead of base OS layer) for quick modification, run without `--rm`
5+
# docker build -f Dockerfile_centos -t qingfengxia/ppp-centos .
6+
7+
# Base OS layer:
8+
FROM centos:8
9+
10+
LABEL name="ppp-centos" \
11+
maintainer="qingfeng.xia @ UKAEA" \
12+
version="0.3" \
13+
description="parallel with OpenCASCADE"
14+
15+
#USER root
16+
17+
# avoid interactive timezone selection, ENV setting will affect child image
18+
# ENV TZ=Europe/London
19+
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
20+
21+
# using yum command -y
22+
ENV DEBIAN_FRONTEND=noninteractive
23+
24+
# centos-release-scl is only needed for cento 7.6 or lower
25+
# yum install epel-release centos-release-scl -y
26+
# the default cmake version is too low 2.8 for centos7
27+
28+
# you must update before any yum install or add a repo
29+
# dnf group install "Development Tools" -y
30+
RUN yum install epel-release -y && yum update -y && dnf groupinstall "Development Tools" -y \
31+
&& yum install wget cmake git python3 python3-devel -y
32+
33+
34+
RUN yum install tbb tbb-devel freetype freetype-devel fontconfig-devel freeimage freeimage-devel -y
35+
36+
# for OpenCASCADE, openGL is needed for BUILD_MODULE_Visualization, and TKService
37+
RUN yum install libXmu-devel libX11-devel libXi-devel -y
38+
39+
# install those below if Draw module is enabled for building OpenCASCADE
40+
# yum install tk tcl tk-devel tcl-devel -y
41+
42+
# these packages SDL2_image-devel name maybe centos7, or needed by centos7 only
43+
RUN if test $(awk '/VERSION_ID=/' /etc/*-release | sed 's/VERSION_ID=//' | sed 's/\"//' | sed 's/\"$//' ) = "7" ; then \
44+
yum install SDL2-devel glew-devel glm-devel -y; \
45+
fi
46+
47+
# centos8 install fron non-official repo
48+
RUN if test $(awk '/VERSION_ID=/' /etc/*-release | sed 's/VERSION_ID=//' | sed 's/\"//' | sed 's/\"$//' ) = "8" ; then \
49+
dnf --enablerepo=PowerTools install glew-devel glm-devel SDL2-devel -y; \
50+
fi
51+
52+
# install OpenCASCADE from official readonly repo is not working, it needs to upload ssh pubkey
53+
# https://old.opencascade.com/doc/occt-7.0.0/overview/html/occt_dev_guides__git_guide.html
54+
# git clone -b V7_4_0p1 gitolite@git.dev.opencascade.org:occt occt
55+
56+
RUN cd $HOME && wget "http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=V7_4_0p1;sf=tgz" -O occt.tar.gz && \
57+
tar -xzf occt.tar.gz
58+
59+
RUN cd $HOME && cd occt-* && \
60+
mkdir build && cd build && \
61+
cmake .. -DUSE_TBB=ON -DBUILD_MODULE_Draw=OFF -DBUILD_MODULE_Visualization=OFF && \
62+
make -j$(nproc) && \
63+
make install && \
64+
cd .. && rm -rf build
65+
66+
67+
ENV DISPLAY :0
68+
69+
70+
RUN cd $HOME && git clone https://github.com/ukaea/parallel-preprocessor.git && \
71+
cd parallel-preprocessor && git submodule update --init --recursive && \
72+
mkdir build && cd build && \
73+
dnf install which -y && \
74+
cmake .. -DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_BUILD_TYPE=Release && \
75+
make -j$(nproc) && \
76+
make install && \
77+
cd .. && rm -rf build
78+
79+
# pppGeomPipeline: error while loading shared libraries: libpppGeom.so: cannot open shared object file: No such file or directory
80+
# /usr/local/lib is not system LD path, the solution is below
81+
ENV LD_LIBRARY_PATH=/usr/local/lib

docker/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Parallel-preprocessor in Docker
22

3-
Since binary packages are available for Ubuntu, fedora and Debian, there is no need to provide Dockerfile on each platforms, but Docker based on centos would be sufficient.
3+
Since binary packages are available for Ubuntu, fedora and Debian, there is no need to provide Dockerfile on each platforms, but only one Docker image based on centos will be maintained
44

5-
## Readme for ppp_centos docker image
5+
## Readme for ppp-centos docker image
66

7-
`docker pull qingfengxia/ppp_centos`
8-
9-
This is should be small image with only occt and ppp; both are compiled from source.
7+
`docker pull qingfengxia/ppp-centos`
8+
This is should be a small image (size 1.6 GB) based on centos8, with only occt (v7.4) and PPP compiled from source.
109

10+
It is designed for any user want to try ppp using docker.
1111

1212
## Readme for ppp_openmc docker image
1313

@@ -17,7 +17,8 @@ Note: this image is large, about 10 GB
1717

1818
## Get the docker image
1919

20-
`docker pull qingfengxia/ppp_openmc`
20+
`docker pull qingfengxia/ppp_openmc` for jupyter notebook way
21+
`docker pull qingfengxia/ppp_openmc_ssh` for jupyter notebook and ssh ways, it is based on image `qingfengxia/ppp_openmc`
2122

2223
https://hub.docker.com/repository/docker/qingfengxia/ppp_openmc
2324

@@ -27,7 +28,7 @@ The docker image is based on `jupyter/mini-notebook` , but it can be switched to
2728

2829
## Use this image
2930

30-
There are 3 ways to use this docker image, choose the one you like
31+
There are 3 ways to use these docker images, choose the one you like
3132

3233
### 1. The jupyter notebook way
3334

@@ -44,7 +45,7 @@ https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html
4445

4546
> -e GRANT_SUDO=yes - Instructs the startup script to grant the NB_USER user passwordless sudo capability. You do not need this option to allow the user to conda or pip install additional packages. This option is useful, however, when you wish to give $NB_USER the ability to install OS packages with apt or modify other root-owned files in the container. For this option to take effect, you must run the container with --user root. (The start-notebook.sh script will su $NB_USER after adding $NB_USER to sudoers.) You should only enable sudo if you trust the user or if the container is running on an isolated host.
4647
47-
### 2. X11 forwarding on local machine
48+
### 2. X11 forwarding on local Linux host machine (deprecated as X11 via SSH is more convenient)
4849

4950
to get an interative bash shell, as ubuntu 20.04
5051

@@ -68,24 +69,24 @@ See https://medium.com/@l10nn/running-x11-applications-with-docker-75133178d090
6869

6970
### 3. SSH remote shell
7071
SSH has also X11 forwarding turned on
71-
`docker run --rm -p 2222:22 -e GRANT_SUDO=yes --user root -it ppp_openmc bash ` then start the ssh server by `sudo service ssh start `
72+
`docker run --rm -p 2222:22 -p 8888:8888 -e GRANT_SUDO=yes --user root -it ppp_openmc_ssh bash ` then start the ssh server by `sudo service ssh start `
7273

7374
This argument `-p 2222:22` map container's port 22 to host 2222 port.
74-
To access this container by ssh:
75-
either `ssh localhost -p 2222` or `ssh <container_ip> -p 22`
75+
To access this container by ssh (-v means verbose, -Y means X11 forwarding):
76+
either `ssh -v -Y localhost -p 2222` or `ssh -v -Y <container_ip> -p 22`
7677

7778
see also [How to setup an ssh server within a docker container](https://phoenixnap.com/kb/how-to-ssh-into-docker-container)
7879
rebuild the image will change ssh server public key, as the ssh server installation will generate new key pair each time.
7980

80-
#### user name and password for ssh both “test”
81+
#### user name is "jovyan" and password is “test”
8182

8283
On Ubuntu, install the `sshpass` package, then use it like this: `sshpass -p 'YourPassword' ssh user@host`
8384

8485
#### start ssh server automatically
8586

86-
Automatically start the ssh server is possible by uncomment `CMD ["/usr/sbin/sshd","-D"]` in Dockerfile if **Rebuild with ubuntu:focal as the base image**.
87+
Automatically start the ssh server is possible by `CMD ["/usr/sbin/sshd","-D"]` in Dockerfile_ssh, if the docker container is running non-interactively (without -it option)
8788

88-
Currently, `CMD ["/usr/sbin/sshd","-D"]` is commented out, because it will override the jupyter’s start_notebook CMD.
89+
In Dockerfile_ssh, the line `CMD ["/usr/sbin/sshd","-D"]` will override the jupyter’s start_notebook CMD.
8990

9091
> Multiple CMD commands: In principle, there should only be one CMD command in your Dockerfile. When CMD is used multiple times, only the last instance is executed.
9192
https://www.educative.io/edpresso/what-is-the-cmd-command-in-docker
@@ -94,7 +95,6 @@ Currently, `CMD ["/usr/sbin/sshd","-D"]` is commented out, because it will over
9495
### Rebuild with ubuntu:focal as the base image
9596
change in Dockerfile before build:
9697
1) FROM ubuntu:focal
97-
2) uncomment `CMD ["/usr/sbin/sshd","-D"]`
9898
Then build with command line,
9999
`sudo docker build -f -e NB_USER=root Dockerfile_ppp_openmc -t ppp_openmc . --no-cache`
100100

0 commit comments

Comments
 (0)