i  have following dockerfile: # Use base CUDA image
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04

# Update NVIDIA GPG key
RUN rm /etc/apt/sources.list.d/cuda.list && \
    apt-key del 7fa2af80 && \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget && \
    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
    dpkg -i cuda-keyring_1.0-1_all.deb

# Preseed tzdata and install dependencies
RUN truncate -s0 /tmp/preseed.cfg && \
    echo "tzdata tzdata/Areas select Europe" >> /tmp/preseed.cfg && \
    echo "tzdata tzdata/Zones/Europe select Berlin" >> /tmp/preseed.cfg && \
    debconf-set-selections /tmp/preseed.cfg && \
    rm -f /etc/timezone /etc/localtime && \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata sudo nano git ffmpeg libsm6 libxext6 && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Miniconda
ENV CONDA_DIR=/opt/conda
ENV PATH="$CONDA_DIR/bin:$PATH"

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
    rm ~/miniconda.sh && \
    $CONDA_DIR/bin/conda clean -afy && \
    ln -s $CONDA_DIR/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
    echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.bashrc

# Update conda, set channel priority to strict, and install mamba
RUN conda update -n base -c defaults conda -y && \
    conda config --set channel_priority flexible && \
    conda install -n base -c conda-forge mamba -y

# Copy your conda environment file
COPY conda_env.yml /tmp/conda_env.yml

# Create Conda environment with mamba
RUN mamba env create -f /tmp/conda_env.yml -p /opt/conda/envs/isuor && \
    conda clean -afy && \
    conda env list

# Set environment variables to use the new environment
ENV CONDA_DEFAULT_ENV=isuor
ENV PATH="$CONDA_DIR/envs/isuor/bin:$PATH"

# Initialize conda
RUN conda init bash
RUN conda run -p /opt/conda/envs/isuor pip install openmim && \
    conda run -p /opt/conda/envs/isuor mim install mmcv-full==1.7.1

# Verify that mim is installed
RUN ls /opt/conda/envs/isuor/bin/

# Activate the environment
ENV PATH /opt/conda/envs/isuor/bin:$PATH

# Install MMDetection from source
RUN git clone https://github.com/open-mmlab/mmdetection.git /mmdet && \
    cd /mmdet && \
    git checkout 94afcdc && \
    pip install -v -e .

# Install Monocular-Depth-Estimation-Toolbox from source
RUN git clone https://github.com/zhyever/Monocular-Depth-Estimation-Toolbox.git /mde_toolbox && \
    cd /mde_toolbox && \
    git checkout 7c0c89c && \
    pip install -v -e .

# Update PYTHONPATH and activate the environment in .bashrc for interactive sessions
RUN echo "export PYTHONPATH=/isuor/src:${PYTHONPATH}" >> ~/.bashrc && \
    echo "conda activate isuor" >> ~/.bashrc

# Verify that __init__.py exists
RUN ls -la /mde_toolbox/depth/
# Adjust MMCV_MAX version in MDE-Toolbox to prevent version complaints
RUN sed -i "s/MMCV_MAX = '1.5.0'/MMCV_MAX = '1.8.0'/g" /mde_toolbox/depth/__init__.py

# Install yapf to fix configuration printing bug
RUN pip install yapf==0.40.1

# Replace memory hook in MMCV to fix GPU context issue
COPY patch/hooks_memory.py $CONDA_DIR/envs/isuor/lib/python3.9/site-packages/mmcv/runner/hooks/memory.py and get following error while building it:  => ERROR [ 2/17] RUN rm /etc/apt/sources.list.d/cuda.list &&     apt-key del 7fa2af80 &&     apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get instal  12.1s
------
 > [ 2/17] RUN rm /etc/apt/sources.list.d/cuda.list &&     apt-key del 7fa2af80 &&     apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget &&     wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb &&     dpkg -i cuda-keyring_1.0-1_all.deb:
0.341 rm: cannot remove '/etc/apt/sources.list.d/cuda.list': No such file or directory
------
Dockerfile:5
--------------------
   4 |     # Update NVIDIA GPG key
   5 | >>> RUN rm /etc/apt/sources.list.d/cuda.list && \
   6 | >>>     apt-key del 7fa2af80 && \
   7 | >>>     apt-get update && \
   8 | >>>     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget && \
   9 | >>>     wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
  10 | >>>     dpkg -i cuda-keyring_1.0-1_all.deb
  11 |
--------------------
ERROR: failed to solve: process "/bin/sh -c rm /etc/apt/sources.list.d/cuda.list &&     apt-key del 7fa2af80 &&     apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget &&     wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb &&     dpkg -i cuda-keyring_1.0-1_all.deb" did not complete successfully: exit code: 1