宿主机conda环境迁移到docker中

JinLonghua    2020-08-06 10:53

conda-pack打包(https://www.anaconda.com/blog/moving-conda-environments
1. 安装

pip install conda-pack

2. 打包
conda pack -n my_env -o out_name.tar.gz

 

3. 写入docker环境中(需要更改成dockerfile中的形式)
# Unpack environment into directory `my_env`
$ mkdir -p my_env
$ tar -xzf my_env.tar.gz -C my_env

# Use Python without activating or fixing the prefixes. Most Python
# libraries will work fine, but things that require prefix cleanups
# will fail.
$ ./my_env/bin/python
于docker内激活环境(https://towardsdatascience.com/conda-pip-and-docker-ftw-d64fe638dc45
或是直接使用如./my_env/bin/python 命令替代python命令。


 
Last Modified: 2020-08-06 15:43
Views: 2.7K

[[total]] comments

Post your comment
  1. [[item.time]]
    [[item.user.username]] [[item.floor]]Floor
  2. Click to load more...
  3. Post your comment