condaとpipの併用が必要なpython分析環境をdockerで構築したく、以下のリンクを参考にして、Dockerfileを作ってbuildしました。
build時にはエラがー発生せず、うまくいっていると思っていたのですが、このimageをrunすると、pipでインストールしたパッケージを読み込めませんでした。また、実際に、コンテナ内でpipによるインストールパッケージを確認(pip freeze)をしても、pipでインストールしたパッケージが見つからない状態でした。
間違っているところがあれば指摘いただけないでしょうか?
Dockerfile
1FROM ubuntu:latest 2 3# install linux commands 4RUN apt-get -y update && apt-get install -y \ 5sudo \ 6wget \ 7vim \ 8curl \ 9unzip 10 11# add Japanese packages to ubuntu 12RUN apt-get install -y language-pack-ja-base language-pack-ja \ 13fontconfig fonts-takao && locale-gen ja_JP.UTF-8 14ENV LANG ja_JP.UTF-8 15ENV LANGUAGE ja_JP:ja 16ENV LC_ALL ja_JP.UTF-8 17 18# install miniconda3-py3.6 19WORKDIR /opt 20RUN wget https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh && \ 21sh /opt/Miniconda3-4.5.4-Linux-x86_64.sh -b -p /opt/miniconda3 && \ 22rm -f Miniconda3-4.5.4-Linux-x86_64.sh 23 24# set path 25ENV PATH /opt/miniconda3/bin:$PATH 26 27# install libraries 28RUN pip install --upgrade pip && \ 29pip install xlrd japanize_matplotlib openpyxl optuna scikit-learn==0.23.2 sklearn 30 31RUN conda install conda=4.8.3=py36_0 && \ 32conda config --append channels conda-forge && \ 33conda install -y pandas numpy scipy matplotlib tensorflow rdkit 34 35# make 'work' directory 36WORKDIR / 37RUN mkdir /work
Docker buildした後、作成したコンテナをrunし、pip freezeを実行した結果
absl-py @ file:///tmp/build/80754af9/absl-py_1623867230185/work aiohttp @ file:///tmp/build/80754af9/aiohttp_1614360992924/work asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work astor==0.8.1 astunparse==1.6.3 async-timeout==3.0.1 attrs @ file:///tmp/build/80754af9/attrs_1620827162558/work blinker==1.4 Bottleneck==1.3.2 brotlipy==0.7.0 cached-property @ file:///tmp/build/80754af9/cached-property_1600785575025/work cachetools @ file:///tmp/build/80754af9/cachetools_1619597386817/work certifi==2021.5.30 cffi @ file:///tmp/build/80754af9/cffi_1625807838443/work chardet @ file:///tmp/build/80754af9/chardet_1605303185383/work click @ file:///tmp/build/80754af9/click_1621604852318/work conda==4.10.3 conda-package-handling @ file:///tmp/build/80754af9/conda-package-handling_1618262148928/work coverage @ file:///tmp/build/80754af9/coverage_1614613670853/work cryptography @ file:///tmp/build/80754af9/cryptography_1616769286105/work cycler==0.10.0 Cython @ file:///tmp/build/80754af9/cython_1626256955500/work flatbuffers @ file:///tmp/build/80754af9/python-flatbuffers_1614345733764/work gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1596839682936/work google-auth @ file:///tmp/build/80754af9/google-auth_1626320605116/work google-auth-oauthlib==0.4.1 google-pasta==0.2.0 greenlet @ file:///tmp/build/80754af9/greenlet_1620913319000/work grpcio @ file:///tmp/build/80754af9/grpcio_1614884175859/work h5py @ file:///tmp/build/80754af9/h5py_1622088445520/work idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1617874469820/work Keras-Preprocessing @ file:///tmp/build/80754af9/keras-preprocessing_1612283640596/work kiwisolver @ file:///tmp/build/80754af9/kiwisolver_1612282420641/work Markdown @ file:///tmp/build/80754af9/markdown_1614363528767/work matplotlib @ file:///tmp/build/80754af9/matplotlib-suite_1613407855456/work mkl-fft==1.3.0 mkl-random @ file:///tmp/build/80754af9/mkl_random_1626186064646/work mkl-service==2.4.0 multidict @ file:///tmp/build/80754af9/multidict_1607367757617/work numexpr @ file:///tmp/build/80754af9/numexpr_1618856167419/work numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1626271506491/work oauthlib @ file:///tmp/build/80754af9/oauthlib_1623060228408/work olefile==0.46 opt-einsum @ file:///tmp/build/80754af9/opt_einsum_1621500238896/work pandas==1.3.0 Pillow @ file:///tmp/build/80754af9/pillow_1625670623564/work protobuf==3.14.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycairo==1.19.1 pycosat==0.6.3 pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work PyJWT @ file:///tmp/build/80754af9/pyjwt_1619651636675/work pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work pyparsing @ file:///home/linux1/recipes/ci/pyparsing_1610983426697/work PyQt5==5.12.3 PyQt5-sip==4.19.18 PyQtChart==5.12 PyQtWebEngine==5.12.1 PySocks @ file:///tmp/build/80754af9/pysocks_1605305779399/work python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work reportlab==3.5.67 requests @ file:///tmp/build/80754af9/requests_1608241421344/work requests-oauthlib==1.3.0 rsa @ file:///tmp/build/80754af9/rsa_1614366226499/work ruamel-yaml-conda @ file:///tmp/build/80754af9/ruamel_yaml_1616016699510/work scipy @ file:///tmp/build/80754af9/scipy_1618855647378/work six @ file:///tmp/build/80754af9/six_1623709665295/work SQLAlchemy @ file:///tmp/build/80754af9/sqlalchemy_1626325196438/work tensorboard @ file:///home/builder/ktietz/aggregate/tensorflow_recipes/ci_baze37/tensorboard_1622025863084/work/tensorboard-2.5.0-py3-none-any.whl tensorboard-plugin-wit==1.6.0 tensorflow @ file:///home/builder/ktietz/aggregate/tensorflow_recipes/ci_baze37/tensorflow-base_1622107655743/work/tensorflow_pkg/tensorflow-2.5.0-cp38-cp38-linux_x86_64.whl tensorflow-estimator @ file:///home/builder/ktietz/aggregate/tensorflow_recipes/ci_baze37/tensorflow-estimator_1622026529081/work/tensorflow_estimator-2.5.0-py2.py3-none-any.whl termcolor==1.1.0 tornado @ file:///tmp/build/80754af9/tornado_1606942300299/work tqdm @ file:///tmp/build/80754af9/tqdm_1625563689033/work typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1624965014186/work urllib3 @ file:///tmp/build/80754af9/urllib3_1625084269274/work Werkzeug @ file:///home/ktietz/src/ci/werkzeug_1611932622770/work wrapt==1.12.1 yarl @ file:///tmp/build/80754af9/yarl_1606939922162/work zipp @ file:///tmp/build/80754af9/zipp_1625570634446/work
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/07/26 08:09 編集
2021/07/27 11:35
2021/08/03 00:55