Singularity container cannot find files after being created from a Docker image

181 views Asked by At

I am creating a Singularity container from a Docker image. However, the Singularity container gives me errors that weren't present while I used Docker.

This is how I create my Docker image -

FROM ubuntu:22.04

WORKDIR /app

SHELL ["/bin/bash", "-c"] 

RUN echo "Hello World!"
RUN apt-get update && apt-get install -y \
    libosmesa6-dev \
    sudo \
    wget \
    curl \
    unzip \
    gcc \
    g++ \
    &&  apt-get install \
    libosmesa6-dev \
    && rm -rf /var/lib/apt/lists/*
    
ENV DEBIAN_FRONTEND=noninteractive

ENV PATH="/miniconda3/bin:${PATH}"
ARG PATH="/miniconda3/bin:${PATH}"
RUN cd / \
    && mkdir -p /miniconda3 \
    && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /miniconda3/miniconda.sh \
    && bash /miniconda3/miniconda.sh -b -u -p /miniconda3 \
    && /miniconda3/bin/conda init bash \
    && source ~/.bashrc \
    && conda init \
    && conda create -y -n myenv python=3.8 \
    && conda update -y conda
    
WORKDIR /~
RUN wget https://roboti.us/download/mjpro150_linux.zip \
    && unzip mjpro150_linux.zip \
    && mkdir ~/.mujoco \
    && mv mjpro150 ~/.mujoco \
    && wget https://roboti.us/file/mjkey.txt \
    && mv mjkey.txt ~/.mujoco \
    && rm mjpro150_linux.zip


RUN cd /miniconda3/envs/myenv/lib/ && mv libstdc++.so.6 libstdc++.so.6.old && ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]
EXPOSE 5003


RUN pip install --no-cache-dir "Cython<3" \
    && pip install mujoco-py==1.50.1.0 \
    && pip install gym
    

This is how I build, run and test my Docker image -

docker build -t dockercontainer:latest .
docker run -it dockercontainer:latest 

Once inside the container -

conda run -n myenv python -c"import gym; gym.make('Humanoid-v3')"

This works (except for a few warnings).

Then, I build a Singularity container from the Docker image -

singularity build singularity_container.sif docker-daemon://dockercontainer:latest

This is how I run the Singularity container -

singularity exec singularity_container.sif/ conda run -n myenv python -c"import gym; gym.make('Humanoid-v3')"

But then I get this error over here -

File "/home/thoma/.local/lib/python3.8/site-packages/mujoco_py/config.py", line 37, in init_config
    raise error.MujocoDependencyError('Found your MuJoCo license key but not binaries. Please put your binaries into ~/.mujoco/mjpro131 or set MUJOCO_PY_MJPRO_PATH. Follow the instructions on https://github.com/openai/mujoco-py for setup.')
mujoco_py.error.MujocoDependencyError: Found your MuJoCo license key but not binaries. Please put your binaries into ~/.mujoco/mjpro131 or set MUJOCO_PY_MJPRO_PATH. Follow the instructions on https://github.com/openai/mujoco-py for setup.

ERROR conda.cli.main_run:execute(124): `conda run python -cimport gym; gym.make('Humanoid-v3')` failed. (See above for error)
0

There are 0 answers