Dockerfile

  • docker build -t PyCharm:2021.3 .
FROM python:3.8.16-slim

RUN  sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
    sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list && \ 
    apt update -y && \
    mv /etc/localtime /etc/localtime_bak && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime   && \
    echo "Asia/Shanghai" > /etc/timezone

RUN apt-get install -y  less libxext6 libxrender1 libxtst6 libfreetype6 libxi6 \
    curl git && \
    python -m pip install --upgrade pip -i https://pypi.douban.com/simple && \
    pip install projector-installer -i https://pypi.douban.com/simple 


RUN projector --accept-license ide autoinstall \
    --config-name Pycharm \
    --ide-name "PyCharm Community Edition 2021.3"  \
    --port 9999 \
    --hostname 0.0.0.0 \
    --password xxxx  \
    --ro-password xxxx2

ENTRYPOINT ["projector","run","Pycharm"]

访问地址

http://IP/?token=xxxx&notSecureWarning=false
#只读模式
http://IP/?token=xxxx2&notSecureWarning=false

pycharm环境配置

取消download pre-built shared indexes自动下载
1. Tools->shared Indexes ->Don't download,user local indexes
2. 右下角->[No interpretor] ->Virtualenv Environment->Existing environment->
选择虚拟环境目录 /opt/conda/envs/nlp/bin/python
Make availableto all projects 所有项目应用
 或者:settings-> Project home ->python Interpreter....