0

I have a docker file like :

FROM conda/miniconda3-centos7
WORKDIR /tmp 
COPY app/ /tmp 
RUN conda install gcc_linux-64 
RUN conda install gxx_linux-64 
CMD ["python", "Hello_World.py"]

The code gets stuck after the first RUN conda command. The error i get is :

WARNING: The conda.compat module is deprecated and will be removed in a future release.


==> WARNING: A newer version of conda exists. <==
    current version: 4.6.11
    latest version: 4.9.2

Please update conda by running

$ conda update -n base -c defaults conda


Removing intermediate container 277edb28a107
 ---> e6b51d71eac0
Step 7/8 : RUN conda install gxx_linux-64
 ---> Running in 94166fbfff2a
Traceback (most recent call last):
  File "/usr/local/bin/conda", line 12, in <module>
    from conda.cli import main
ModuleNotFoundError: No module named 'conda'
The command '/bin/sh -c conda install gxx_linux-64' returned a non-zero code: 1

Can you please suggest?

Madness
  • 127
  • 1
  • 6
  • I tried a few more things. I removed the first conda command to install gcc and then ran the code and it works fine. But for some reason i am unable to run 2 separate conda install commands – Madness Feb 09 '21 at 09:02

1 Answers1

0

Adding conda update -n base -c defaults conda in your Dockerfile solves the mentioned problem.

You could also consider using && for optimizing the creation of docker images. Read more about it here.

An optimized Dockerfile would be:

FROM conda/miniconda3-centos7
WORKDIR /arnav
COPY app/ /arnav
RUN conda update -n base -c defaults conda \
    && conda install gcc_linux-64 && conda install gxx_linux-64
CMD ["python", "Hello_World.py"]
Krishna Chaurasia
  • 8,924
  • 6
  • 22
  • 35
  • This is working as intended. Thank you for the solution. I apologies for not using && as im quite new to Docker. Ill keep it in mind. – Madness Feb 09 '21 at 09:33
  • 1
    No need for an apology @Madness, we can't learn everything on our own and learn from others experience too :) – Krishna Chaurasia Feb 09 '21 at 09:51