Announcing PyCharm 5 EAP 143.165: Docker Integration

Hello everyone,

Today we announce PyCharm 5 EAP build 143.165, bringing Docker integration and a lot of other important improvements.

Please download the build from our EAP page.

The most notable brand-new feature in this build is the Docker integration.

Note: Docker integration is available only in PyCharm Professional Edition

dockerWith this integration you can specify a Python interpreter from a Docker container and use it in your project. Docker is a popular open platform for distributed applications for developers and sysadmins. Please read more about Docker on its official website.

Note: Docker integration with PyCharm works on Windows, Linux and Mac OS platforms. However you’ll need to install Docker yourself. Please check the Docker installation documentation on how to install Docker on your system.

In order to set up a Python interpreter inside a Docker container for your project, simply go to Settings (Preferences for Mac OS) | Project | Project Interpreter and add a new remote interpreter as shown on the image below:

docker_0

It will show you a dialog box where you can choose the “Docker” option and specify different settings for accessing a Docker machine, as well as an image to be used for creating a Docker container:

dockerscreen

After applying the settings, the interpreter will be set as your default project interpreter.
Now you can Run, Debug and Profile your application using Python inside a Docker container:

Docker_debug

The Python interpreter inside a Docker container can also be used with the PyCharm’s interactive Python console. Open it with Tools | Python console:

docker_console

Other notable improvements in this build:

  • The new “Move local function or method to the top level” refactoring
  • Numerous fixes for remote interpreters,
  • Fixes for PyCharm’s debugger
  • Fixes for Python inspections
  • Many different fixes and improvements for JavaScript/TypeScript support
  • Numerous platform improvements.

For the detailed list of changes and improvements, please check the Release Notes.

Please download PyCharm 5 EAP build 143.165 today! Should you encounter any bugs, please report them to our public tracker.

You can download the build or use the patch-based upgrade to upgrade from within the IDE (from previous PyCharm 5 EAP builds only) without a full re-installation. Just make sure you’ve selected the EAP channel in update settings.

Important note: the patch-based upgrade for this build is available only for Windows and Linux platforms. For Mac OS, you’ll need to download the full dmg image and replace your previous PyCharm 5 EAP installation.

Develop with pleasure!
JetBrains PyCharm Team

About Dmitry Filippov

Product Marketing Manager at JetBrains
This entry was posted in Early Access Preview, Uncategorized. Bookmark the permalink.

49 Responses to Announcing PyCharm 5 EAP 143.165: Docker Integration

  1. Adrian says:

    Can it manage docker containers on a remote machine (via SSH)?

    • Jay says:

      Not over SSH, they are talking directly to the docker daemon. So if you want to manage a remote machine, you’ll have to set up the daemon to listen on the public port. Docker Machine will do this automatically for you.

      • Adrian says:

        Being able to do that over SSH would be great. There are some very good reasons to keep the daemon socket locked down (unix socket with very restricted permissions). No need for the extra complexity that goes along with certificate-based authentication on a network-facing socket…

  2. Volodymyr says:

    Vagrant/remote interpreter still not working (does not index, no completion)
    There are couple of issues related
    PY-17154
    PY-17143

  3. Artem says:

    PyCharm could not resolve any libs (even builtins like float, dict) on Vagrant remote interpreter. There are nothing in interpreter paths and no refresh button.

  4. Ethan says:

    I’m a little confused about what to put for the image name if I’m interested in using the python interpreter from an image created via a Dockerfile in my project. Should I use the IMAGE ID from the docker images command? Or the REPOSITORY field?

    Or will this only work for images that can be fetched from docker hub for the time being?

    Thanks, looking forward to using this functionality!

    • Alexander Koshevoy says:

      Ethan,

      You could use IMAGE ID as well as REPOSITORY field. It is not required for Docker image to be originated from the Docker hub.

  5. Daniel says:

    Any ETA on Docker Compose integration?

    • howaryoo says:

      @daniel,

      you can use docker-compose with pycharm by running pycharm in docker.

      Below an example tested on ubuntu 14.04LTS, I know there are issues with the latest 15.x version and this has not been tested on other platforms.

      Compose file:
      https://github.com/howaryoo/pastelike/blob/master/docker-compose.yml#L64

      docker-file allowing to run the desktop GUI :
      https://github.com/howaryoo/pastelike/blob/master/DockerfileDeveloper.docker

      example project available in the same repo.

      • wowkalucky says:

        Hi! I’m just trying to taste Docker, but very impressed with its concept already.
        Now I have created a little Django project with five containers, they start with docker-compose
        and work properly.
        But now I want my Pycharm development back! (=
        I tried ver.5.0 EAP with Docker interpreter integration, but for now it supports only
        “single image mode” (if I’m not mistaken) what in most cases brokes all cool features!
        And I’m very interested in the idea of launching Pycharm in container. So I tried to run your project (pastelike) as start point, but not successfully: it builds ok, but pycharm container cannot run.
        I think, I miss something in understanding of its prerequsites.
        Could you tell in few words on what key moments I should focus my attention
        (dirs structure, where Pycharm stuff should be, etc.). Tnx.

        • howaryoo says:

          Hi, sorry for the late answer,

          1)
          your whole home directory (~) is mounted on the /home/developer folder of the container running pycharm.

          volumes:
          – /tmp/.X11-unix:/tmp/.X11-unix
          – ~:/home/developer

          2)
          The entrypoint of the pycharm service in the compose file is:
          entrypoint: [“/home/developer/bin/pycharm.sh”]

          so if you add a symbolic link as below (or the pycharm startup script) under ~/bin, the ‘pycharm’ service will run inside a container whatever version of pycharm you have installed. You also get for free all the benefits of compose: you have all links available … You can check this by opening pycharm’s terminal.

          On your host:
          $ ls -al ~/bin/pycharm.sh
          lrwxrwxrwx 1 ah ah 37 May 27 19:35 /home/ah/bin/pycharm.sh -> ../local/pycharm-4.5.1/bin/pycharm.sh

          Hope that helps.
          This works great on ubuntu 14.04LTS.

  6. Russ Helfand says:

    Docker image of Ubuntu running Flask app -> uWSGI -> NGINX.

    I’ve gotten the PyCharm preferences’ interpreter to see inside my Docker container. It lists the right modules, etc.

    Now, I’d like to use a browser to visit a page served up by this container and debug the code as it runs in the container… but using PyCharm to do so.

    Can anyone give me a recipe for doing so? (I also enjoy a nice curry recipe or something with Garbanzo beans.)

    • Alexander Koshevoy says:

      For a server application run on Docker container to be available on the host machine we need to ask Docker to expose and publish the port which the server application listens to. In this EAP port publishing is not yet supported. Django is going to be supported firstly with its specific Run Configuration. Flask will taken care a bit lately.

  7. “or use the patch-based upgrade to upgrade from within the IDE (from previous PyCharm 5 EAP builds only) without a full re-installation.”

    Where do i find the upgrade for windows?
    I am running 142.4957 and want to upgrade to 143.165, as PyCharm reminds me there is a newer EAP-Version. But i don’t find an option inside PyCharm or a special download at the downloadpage.

    • Dmitry Filippov says:

      Please go to Help | Check for Updates. In the same dialog there is a link to the update settings. Please ensure you selected the “Early Access Preview” channel.

      • I think you mean “Early Access Program”? Then Yes, it was/is checked. Without that PyCharm wouldn’t have messaged me there is a newer EAP.
        Otherwise, there is no “Early Access Preview”. The nearest other would be “Beta Releases or Public Previews”.

        • Dmitry Filippov says:

          What does the dialog tell you? just a link to the EAP confluence page? if yes, that means we don’t provide patch? Do you use Mac OS? If yes, we had problems with patches for these builds.

          • Yes, all i got was a link to the EAP confluence page.

            If you don’t provide a patch-based upgrade, why did you wrote this: “Important note: the patch-based upgrade for this build is available only for Windows and Linux platforms. [..]”?
            Without that i never mind to search for a patch-based upgrade.

  8. Ricardo Duarte says:

    I’ve tried to configure Docker remote interpreter but I’m getting the following error:

    Docker Machine exited with error code 1: open /home/ricardo/.docker/machine/machines: permission denied

    Any ideas?

  9. Daniel Gollas says:

    This is great! However, my docker containers are usually brought up by docker-compose and some links between different containers exist (mainly between the “web” container and the database container, “db”).

    My settings.py file points the database at the “db” host, which is set in the django container’s host file by docker-compose when it brings up the containers and knows their IPs.

    Launching the “web” container using PyCharm 5 EAP docker remote interpreter correctly starts the development server but it stumbles when it tries to establish a connection to the “db” hosted database (obviously since nobody told it where it is). Any ideas on how to overcome this?

    I’m thinking some sort of compose integration to set the appropriate entries in the host file, but have no idea how that would work.

    Thanks!

  10. Ron Smith says:

    How about an updated tutorial now that this has been released. Maybe something that starts with using the Application Servers to setup the docker container. I am having a hard time getting my head wrapped around docker in general and how to effectively integrate it with PyCharm.

  11. Nuno Khan says:

    So i have beeen using docker-compose in development for a while now on my Ubuntu 14.04 LTS host machine with a local VirtualBox provider (boot2docker inside it).

    Only recently i decided to try out docker-machine (because of the integration with Pycharm) but i am running into some issues like for example when i save some new code the docker container is not updated automatically anymore and i think its because i commented out my volumes in my docker-compose.yml web service but if i don’t i will get a manage.py not found error so i understood in this here that i should comment it instead.

    I have been reading lots of things on the internet and i would like to know if there is a good and simple approach to get docker-machine playing nicely with docker-compose on Ubuntu.

    DockerFile

    FROM ubuntu:14.04.3
    ENV PYTHONUNBUFFERED 1
    RUN apt-get update && apt-get install -y \
    build-essential \
    git-core \
    python2.7 \
    python-pip \
    python-dev \
    libpq-dev \
    postgresql-client-9.3 \
    libjpeg-dev \
    binutils \
    libproj-dev \
    gdal-bin
    RUN mkdir /vagrant
    WORKDIR /vagrant
    RUN mkdir requirements
    COPY requirements requirements
    RUN pip install -r requirements/local.txt
    COPY . /vagrant/
    docker-compose.yml

    postgis:
    image: mdillon/postgis:9.3
    ports:
    – “5432:5432”
    environment:
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: “postgres”

    web:
    build: .
    dockerfile: Dockerfile
    command: python manage.py runserver 0.0.0.0:8000 –settings=xxx.settings.local
    # http://stackoverflow.com/a/31567743/977622
    # volumes:
    # – .:/vagrant
    ports:
    – “8000:8000”
    links:
    – “postgis:postgis”

  12. Pingback: Using Docker in PyCharm | PyCharm Blog

  13. Pingback: PyCharm: Using Docker in PyCharm-IT大道

  14. I am using Pycharm and I am following your guide but I simply get a message:

    Docker Machine returned empty status string for ‘default’.

    Someone else had the same see:

    https://www.reddit.com/r/docker/comments/3y43lq/using_docker_for_pycharm_interpreter_on_linux/

    I am new to docker so there may be some configuration I am missing since the machine names are not available within the Remote Python Interpreter dialog…any pointers?

  15. John Stanford says:

    I’m trying to understand the interaction between PyCharm and the container a bit better. I have an image that has an ENTRYPOINT to start they jupyter notebook server. PyCharm hands when I try to add it as a remote docker image. I can see containers starting, but it never comes back with the list of libraries from the remote python interpreter.

    If I remove the ENTRYPOINT from the Dockerfile, and instead use CMD /bin/true, PyCharm is able to complete the configuration of the remote interpreter.

    Any guidance is appreciated!

    • Alexander Koshevoy says:

      Hi John!

      PyCharm creates a container based on your image with a command python .... If you have an entrypoint defined Docker passes PyCharm command python ... as the entrypoint’s arguments. So rather entrypoint command executed when running Docker container, but not python.

      This case with entrypoint defined should be handled specifically, maybe within some new workflow. Please, file an issue in https://youtrack.jetbrains.com/issues/PY for us to be able to investigate it.

  16. Ron Cohen says:

    Great first step. What would be really useful would to just have a text field that would allow me to define the arguments i want to docker when PyCharm starts it for me. For example, i need my container to join a network so it can talk to the other services i need to run the tests, mount local directories inside, etc.

  17. Craig Shaw says:

    Has anyone gotten this to work successfully?

    I gave it some good effort. After getting a docker-machine host up and an image built, the only feedback I received was still:

    Docker Machine returned empty status string for ‘default’.

  18. Pasha says:

    Is it possible to use PyCharm to connect to an already-running container for debugging?

Leave a Reply

Your email address will not be published. Required fields are marked *