Whir
Whir

Reputation: 325

Modules and binaries not found in Docker container

I am trying to set up a Docker container with some of my own code. It is some Fortran code that does some calculations on data from grib files. That is not a problem. A dependency is eccodes which I need to compile in my Docker container. It compiles nicely when I build the container, but I have no idea where the modules are. They are not in the usual /usr/local.

I have searched for some binaries when building the container by looking for "grib_dump", which is one executable from eccodes, but with no luck.

I am using this Dockerfile. I do not have much experience with Docker, so maybe I violate some best practices.

FROM ubuntu:18.04

RUN apt-get update
RUN apt-get -y install build-essential cmake wget

# HDF5
RUN apt-get -y install libhdf5-serial-dev

# NetCDF4
RUN apt-get -y install libnetcdf-dev

# gfortran
RUN apt-get -y install gfortran

RUN wget https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.13.1-Source.tar.gz
RUN tar -xzf eccodes-2.13.1-Source.tar.gz
ENV ECCODES_DIR /usr/local
RUN mkdir ecbuild && cd ecbuild && cmake -DCMAKE_INSTALL_PREFIX=$ECCODES_DIR ../eccodes-2.13.1-Source

RUN apt-get -y install python3-pip
# pip
RUN pip3 install schedule
RUN pip3 install netCDF4
RUN pip3 install f90nml

RUN ls $ECCODES_DIR
RUN grib_dump

WORKDIR /kfapp
COPY . /kfapp

RUN make

When I run:

RUN ls $ECCODES_DIR
RUN grib_dump

there is nothing in $ECCODES_DIR and grib_dump is not found. I need to link the module files from eccodes, but I have no idea where to find them, when they are not in $ECCODES_DIR.

Upvotes: 1

Views: 404

Answers (1)

LinPy
LinPy

Reputation: 18608

you can find your build files in /ecbuild you do not find anything in /usr/local because you do not run make and make install after your cmake command

here an example from the Docs:

> tar -xzf  eccodes-x.y.z-Source.tar.gz
> mkdir build ; cd build

> cmake -DCMAKE_INSTALL_PREFIX=/path/to/where/you/install/eccodes ../eccodes-x.y.z-Source
...

> make
> ctest
> make install

PS: you do not need also to set the CMAKE_INSTALL_PREFIX because the /usr/local is the default

Upvotes: 2

Related Questions