Skip to content
Snippets Groups Projects
Commit 287ca90d authored by Guido Sterbini's avatar Guido Sterbini
Browse files

Major modifications to mount EOS

parent 3db2117f
No related branches found
No related tags found
No related merge requests found
# reference: https://hub.docker.com/_/ubuntu/
FROM ubuntu
#FROM jupyter/scipy-notebook
FROM ubuntu:focal
ARG DEBIAN_FRONTEND=noninteractive
# Adds metadata to the image as a key value pair example LABEL version="1.0"
LABEL maintainer="Guido Sterbini <guido(.)sterbini at cern.ch>"
# create empty directory to attach volume
USER root
RUN apt-get -qq update && \
apt-get -y upgrade && \
apt-get -yqq install sudo lsb-release krb5-user libpam-krb5 \
apt-utils tzdata vim tmux sshfs wget curl\
gnupg gnupg1 gnupg2 && \
apt-get -yqq clean && \
echo "Europe/Rome" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata
# for the ROOT code, following https://root.cern/install/dependencies/
RUN apt-get install -y dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev libssl-dev gfortran libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev libxml2-dev libkrb5-dev libgsl0-dev && \
wget https://root.cern/download/root_v6.22.00.Linux-ubuntu19-x86_64-gcc9.2.tar.gz && \
tar -xzvf root_v6.22.00.Linux-ubuntu19-x86_64-gcc9.2.tar.gz
# Installing EOS, following https://cern.service-now.com/service-portal?id=kb_article&n=KB0006614
RUN echo "deb [arch=$(dpkg --print-architecture)] http://storage-ci.web.cern.ch/storage-ci/debian/xrootd/ $(lsb_release -cs) release" \
| sudo tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null && \
echo "deb [arch=$(dpkg --print-architecture)] http://storage-ci.web.cern.ch/storage-ci/debian/eos/citrine/ $(lsb_release -cs) tag" \
| sudo tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null && \
curl -sL http://storage-ci.web.cern.ch/storage-ci/storageci.key | sudo apt-key add - && \
apt -y update && \
apt -y install eos-fusex && \
mkdir /etc/eos && \
echo '{"name":"home-s","hostport":"eoshome-s.cern.ch","remotemountdir":"/eos/user/s/"}' > /etc/eos/fuse.home-s.conf && \
mkdir /eos
# ask <fabio(.)luchetti at cern.ch>
# RUN echo "Package: xrootd* libxrd* libxrootd*\nPin: version 4.12.5\nPin-Priority: 1000" > /etc/apt/preferences.d/xrootd.pref
# RUN useradd -ms /bin/bash sterbini
###############################################################################
# Install utilities
###############################################################################
RUN apt-get -qq update \
&& apt-get -yqq install apt-utils nano curl lsb-release gnupg2 krb5-user \
&& apt-get -yqq clean
###############################################################################
# Install EOS, thanks to @note(faluchet)
# following somehow also
# https://cern.service-now.com/service-portal?id=kb_article&n=KB0006614
###############################################################################
RUN echo "deb [arch=$(dpkg --print-architecture)] \
http://storage-ci.web.cern.ch/storage-ci/debian/xrootd/ \
$(lsb_release -cs) release" \
| tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null \
&& echo "deb [arch=$(dpkg --print-architecture)] \
http://storage-ci.web.cern.ch/storage-ci/debian/eos/citrine/ \
$(lsb_release -cs) tag" \
| tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null \
&& curl -sL http://storage-ci.web.cern.ch/storage-ci/storageci.key \
| apt-key add - \
# @note(faluchet): as of eos version 4.8.40,
# we need to pin xrootd version 4.12.8. Will be lifted in the future
&& echo "Package: xrootd* libxrd* libxrootd*\nPin: \
version 4.12.8\nPin-Priority: 1000" > /etc/apt/preferences.d/xrootd.pref \
&& apt-get -qq update \
&& apt-get -yqq install eos-client eos-fusex \
&& apt-get -yqq clean \
&& mkdir /etc/eos \
# we can prepare the files and then ADD them directly
&& echo '{"name":"home-a","hostport":"eoshome-a.cern.ch",\
"remotemountdir":"/eos/user/a/","localmountdir":"/eos/user/a/"}' > \
/etc/eos/fuse.home-a.conf \
&& echo '{"name":"home-e","hostport":"eoshome-e.cern.ch", \
"remotemountdir":"/eos/user/e/","localmountdir":"/eos/user/e/"}' > \
/etc/eos/fuse.home-e.conf \
&& echo '{"name":"home-s","hostport":"eoshome-s.cern.ch", \
"remotemountdir":"/eos/user/s/","localmountdir":"/eos/user/s/"}' > \
/etc/eos/fuse.home-s.conf \
&& mkdir -p /eos/user/a \
&& mkdir -p /eos/user/e \
&& mkdir -p /eos/user/s \
&& echo '{"name":"project-l","hostport":"eosproject-l.cern.ch",\
"remotemountdir":"/eos/project/l/","localmountdir":"/eos/project/l/"}' > \
/etc/eos/fuse.project-l.conf \
&& mkdir -p /eos/project/l \
# Not a cheap approach, to be discussed
&& echo 'eosxd -ofsname=home-a' >> ~/.bashrc \
&& echo 'eosxd -ofsname=home-e' >> ~/.bashrc \
&& echo 'eosxd -ofsname=home-s' >> ~/.bashrc \
&& echo 'eosxd -ofsname=project-l' >> ~/.bashrc
ADD krb5.conf /etc/krb5.conf
###############################################################################
# Some minimal packages
###############################################################################
RUN apt-get -qq update \
&& apt-get -yqq install x11-apps wget git tmux vim meld \
&& apt-get -yqq clean
###############################################################################
# Install miniconda
# https://hub.docker.com/r/continuumio/miniconda/dockerfile
###############################################################################
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
RUN apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc
# Installing AFS (not working)
#RUN apt-get install -y software-properties-common \
#&& apt-get update \
#&& add-apt-repository ppa:openafs/stable \
#&& apt-get update \
#&& apt-get upgrade
#CMD /bin/bash -c "source root/bin/thisroot.sh":q
#CMD eosxd -ofsname=home-s
#USER jovyan
###########
#RUN pip install cpymad \
# PyHEADTAIL \
#RUN pip install \
# ipython \
# cpymad \
# pandarallel \
# pyarrow \
# sphinx \
# myst-parser \
# pdoc3 \
# geopandas
# sphinx
###########
#RUN mkdir abp
#ENV HOME=/abp
......
# To run the docker
#
To run the docker
To lauch the docker sterbini/test
......@@ -6,14 +7,24 @@ To lauch the docker sterbini/test
docker run -ti --cap-add SYS_ADMIN --device /dev/fuse sterbini/test
```
I did n case you want to mount a local folder this has to be **shared** with Docker
(I did it with Docker Desktop on my Mac)
and then
```
docker run -v /afs:/afs -ti --cap-add SYS_ADMIN --device /dev/fuse sterbini/test
```
I took the kerberos configuration from lxplus.
When you are in the docker you have to do:
``` bash
source root/bin/thisroot.sh
eosxd -ofsname=home-a
eosxd -ofsname=home-e
eosxd -ofsname=home-s
eosxd -ofsname=project-l
kinit sterbini@CERN.CH
```
......@@ -29,3 +40,22 @@ To build the docker
```bash
docker build . -t sterbini/test
```
## To export the Xgraphics on mac
From https://medium.com/@mreichelt/how-to-show-x11-windows-within-docker-on-mac-50759f4b65cb
- Install the latest XQuartz X11 server and run it
- Activate the option ‘Allow connections from network clients’ in XQuartz settings
- Quit & restart XQuartz (to activate the setting)
- On the host do
```
xhost + 127.0.0.1
```
And when you run the docker add
```
-e DISPLAY=host.docker.internal:0
```
that is
```
docker run --rm -e DISPLAY=host.docker.internal:0 -p 8889:8888 -ti --cap-add SYS_ADMIN --device /dev/fuse -e GRANT_SUDO=yes sterbini/test
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment