Fastai and anaconda with DOCKER

I’ve been trying to create a custom docker image, thats to contain a fastai deep learning project. I’ve been trying to use my anaconda environment and used the following dockerfile. However I get the same error I cannot resolve. I’m running a windows 10 machine.

docker file:

FROM continuumio/anaconda3
ADD environment.yml /tmp/environment.yml
RUN conda env create -f /tmp/environment.yml
# Pull the environment name out of the environment.yml
RUN echo "source activate $(head -1 /tmp/environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /opt/conda/envs/$(head -1 /tmp/environment.yml | cut -d' ' -f2)/bin:$PATH

I also tried this docker file:

FROM continuumio/miniconda3

WORKDIR /app

# Create the environment:
COPY environment.yml .
RUN conda env create -f environment.yml

# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]

# Make sure the environment is activated:

# The code to run when container is started:
COPY . .
ENTRYPOINT ["conda", "run", "-n", "myenv", "python", "main.py"]

The error is as below:

failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c conda env create -f /tmp/environment.yml]: runc did not terminate sucessfully

I would really appreciate any help on this. FYI I’m new to dockers.

Hi… did you already solved this ?

You could try create an script file and upload to it in build time to load the environment when you start the terminal session in your Docker container.

After this non-optimal way work you could improve on that.

I found a docker image for fastai and for anaconda, however my project need tkinter for a gui application. And installing that had some issues, both because containers dont have displays and tkinter wasn’t generally avaiable in docker images.

So i’ve given up on this for the time being.

The project I was working on is: https://github.com/akash-shastri/Anything-Classifier

Sorry for the time, but you can enable GUI interface from Docker to your computer. Well at least in Linux machine

I have done in the past in docker.

If you was running a linux machine you could have done something like this to run you docker:

docker run -ti --rm \
-e DISPLAY=":0" \
-v "/tmp/.X11-unix:/tmp/.X11-unix:rw" \
<image>:<release>

Probably you would need to install some library for X11 inside your container, but as you start the application the GUI of it would be rendered “outside” your container and just the processing would be inside the container

Try to see if you can get any benefit from here:

1 Like