Public | Automated Build

Last pushed: 2 years ago
Short Description
A docker file for providing pycharm community edition.
Full Description

Usage

You can create new projects and they will be stored at ~/PycharmProjects/ or add already existing pycharm projects to that folder and use them immediately.

After you launch PyCharm and configure it the configurations will be stored in ~/PycharmProjects/.PyCharm40/ for later use.

The image comes bundled with Python 2.7.9/3.4.3 and their respective pip package managers.
You can use the PyCharm built-in terminal view and use pip to install a new package.
If you are running with persistence a copy of the package installed will be kept on your host machine at ~/PycharmProjects/.Py_lib/ .

For example select the terminal from View|Tool Windows|Terminal (or press Alt+f12):

dev@e9513ef70396:/home/dev/PycharmProjects/untitled$ sudo pip install tornado
[sudo] password for dev: #dev

for installing tornado.

#####Note

You must add Python 2.7.9 and 3.4.3 to the list of available interpreters when PyCharm starts.<br>
From the Welcome page select Configure|Settings|Default Project|Project Interpreters and add the local interpreters Python2.7 and Python3.4.

Build

If you are pulling this image from dockerhub then this step isn't required. If not, use the build.sh script.

Running

I would suggest downloading the run_persistent.sh and run_standard.sh scripts from the source project page but if that isn't an option for some reason you can do this:

Contents of run_persistent.sh

To run in a persistent mode where settings, projects and libraries are stored use this script:

#!/bin/sh
# Runs pycharm Community with the standard python libs.
# Creates the directories needed to retain settings and projects and 
# python libraries  in order for them to persist between sessions.
set -xe

USER=dev
PROJECTS=~/PycharmProjects
SETTINGS=$PROJECTS/.PyCharm40
PY_LIB=$PROJECTS/.Py_lib

# Change image name to match the image built.
IMAGE_NAME=dimitrisjim/pycharm_community

# Create directories if they don't exist.
if [ ! -d "$SETTINGS" ]; then
 mkdir -p $SETTINGS 
 mkdir $SETTINGS/config $SETTINGS/system
 # Required in order for docker container to be able to write to host file system.
 chmod -R ug+rwx $SETTINGS/config $SETTINGS/system 
fi

# Populate python 2.7.9 and 3.4.3 libraries in order to be able to mount
# these directories to our container and make libraries installed persistent.
if [ ! -d "$PY_LIB" ]; then
 mkdir -p $PY_LIB
 docker run -it -d --name "temp" $IMAGE_NAME
 docker cp temp:/usr/local/lib $PY_LIB/ 
 docker rm -v temp
 chmod -R ug+rwx $PY_LIB/
fi

# Accept all local hosts.
xhost +local:*

# Run docker and mount project, settings and library dirs.
xhost - && docker run -ti --rm \
 -e DISPLAY=$DISPLAY \
 -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
 -v $PROJECTS:/home/$USER/PycharmProjects \
 -v $SETTINGS:/home/$USER/.PyCharm40 \
 -v $PY_LIB/lib:/usr/local/lib \
 -u $USER \
 $IMAGE_NAME

you can of course change this script to match what you want to retain.

Contents of run_standard.sh:

To run in a non persistent mode you can run this script:

#!/bin/sh
# Runs pycharm Community without the standard python libs.
set -xe

USER=dev

# Change image name to match the image built.
IMAGE_NAME=dimitrisjim/pycharm_community

# Accept all local hosts.
xhost +local:*

# Run docker container with no mounts.
xhost - && docker run -ti --rm \
 -e DISPLAY=$DISPLAY \
 -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
 -u $USER \
 $IMAGE_NAME

Nothing will be retained after the container is removed. Use this if you want to try PyCharm out.

Docker Pull Command
Owner
dimitrisjim
Source Repository