0

I am trying to create a docker container for miniconda3 using "docker-compose build", however below error code shows.

UNANSWERED NEW QUESTION
Or is there any better way to work with continuumio/miniconda3 docker image to make sure it is pre-installed with some desired list of python packages (for example, through pip install --r requirements.txt or conda create --name myenv --file environment.yml or any other efficient ways)? (or any ways to could continue installing python packages and save those packages after miniconda3 image had been created?)

=> ERROR [4/4] RUN conda env create --name data_science --file environment.yml                                                   160.6s 
------
 > [4/4] RUN conda env create --name data_science --file environment.yml:
#8 8.635 Collecting package metadata (repodata.json): ...working... done
#8 148.5 Solving environment: ...working... failed
#8 148.5
#8 148.5 ResolvePackageNotFound:
#8 148.5   - vs2015_runtime==14.29.30037=h902a5da_5
#8 148.5   - python==3.9.7=h7840368_2_cpython
#8 148.5   - setuptools==58.0.4=py39hcbf5309_2
#8 148.5   - sqlite==3.36.0=h8ffe710_2
#8 148.5   - vc==14.2=hb210afc_5
#8 148.5   - openssl==1.1.1l=h8ffe710_0
#8 148.5   - ca-certificates==2021.5.30=h5b45459_0
#8 148.5   - ucrt==10.0.20348.0=h57928b3_0
#8 148.5
------
executor failed running [/bin/sh -c conda env create --name data_science --file environment.yml]: exit code: 1
ERROR: Service 'node' failed to build : Build failed

Below are the details for my Dockerfile, docker-compose.yml, environment.yml.

Dockerfile

FROM continuumio/miniconda3
WORKDIR /data
COPY environment.yml environment.yml
RUN conda env create --name data_science --file environment.yml

docker-compose.yml

version: "3.8"

services:
  node:
    build: .  
    volumes: 
      - .:/data
    ports: 
      - 8888:8888
    image: node:data
    container_name: miniconda3
    command:
      - jupyter notebook --port=8888 --ip=0.0.0.0 --allow-root

environment.yml

name: python_data_science
channels:
  - conda-forge
  - default
dependencies:
  - ca-certificates=2021.5.30=h5b45459_0
  - openssl=1.1.1l=h8ffe710_0
  - pip=21.2.4=pyhd8ed1ab_0
  - python=3.9.7=h7840368_2_cpython
  - python_abi=3.9=2_cp39
  - setuptools=58.0.4=py39hcbf5309_2
  - sqlite=3.36.0=h8ffe710_2
  - tzdata=2021a=he74cb21_1
  - ucrt=10.0.20348.0=h57928b3_0
  - vc=14.2=hb210afc_5
  - vs2015_runtime=14.29.30037=h902a5da_5
  - wheel=0.37.0=pyhd8ed1ab_1
prefix: C:\Users\tys\.conda\envs\python_data_science

Hope for help. Thanks in advance.

UPDATED
Possible reason of failing:
I think it is because when i run "conda export env > environment.yml" on windows 10, conda will export my environment with builds, but builds can be platform-specific which is not suitable to be installed in miniconda3 linux in the docker container. For more info, refer to this stackoverflow forum, conda environment from windows to linux

Possible solution
(i) (Not sure how to solve yet, but may be could refer to this blog post for more information. Credit to @merv)
(ii) repo2docker

  • Are you going to show us the full output? – Klaus D. Sep 28 '21 at 16:14
  • @Klaus D. I have updated and add more error code on this page. And also, since the output is too long, thus I put it into this google docs: https://docs.google.com/document/d/1cgLK2zb6MXGdoT2k5K4zR__HhuK3BYtxDIVmFmboQ3c/edit?usp=sharing – TAN YONG SHENG Sep 28 '21 at 16:27
  • That env file looks like it came from a Windows machine, but the Miniconda image is Linux. Most of the packages listed are completely unnecessary to include. You might benefit from reading [this blog post](https://uwekorn.com/2021/03/01/deploying-conda-environments-in-docker-how-to-do-it-right.html). – merv Sep 28 '21 at 16:33
  • @merv Thanks for that. Ya, I am running them on vscode windows 10. The blog post seems like would be helpful but a bit complicated for me. I will try to figure it out later. Thanks so much, merv. – TAN YONG SHENG Sep 28 '21 at 16:38
  • I was playing with your `environment.yml` a little and that is possibly causing the problem. When you change for example your `pip=21.2.4=pyhd8ed1ab_0` to `pip=21.2.4` it stops throwing an error and got installed successfully. – Leemosh Sep 28 '21 at 16:51
  • @Leemosh Thanks for help. But I think same error still appears as mentioned above. – TAN YONG SHENG Sep 28 '21 at 17:05
  • There is no ambiguity about the problem: it fails because the YAML is inappropriate, i.e., [they don't simply transfer across platforms](https://stackoverflow.com/q/58009732/570918). Most of what is in this YAML is unnecessary (basically it only defines a Python env, with no substantial packages), so just make a new one from scratch that lists only the packages you need for your code to run. – merv Sep 28 '21 at 19:55

1 Answers1

-1

Try Adding this at the beginning of your DockerFile-

FROM continuumio/miniconda3

or changing the respective image name in docker-compose.yml

Agnij
  • 561
  • 3
  • 13
  • ya, added already, just now careless forgot to copy paste that part. Sorry for that. What do you mean by changing image name (i.e. node) in docker-compose.yml? Why the image name cause the error? – TAN YONG SHENG Sep 28 '21 at 15:57