Python P2: PyCharm with a Docker Interpreter

Debug inside the container—directly from PyCharm

In the previous article, we looked at setting up Python with Docker. We skipped all of the environment headaches. If you’re using PyCharm, you might have noticed that everything is underlined red, like your code is broken. Let’s fix that with Docker again.

Open up PyCharm and go to your interpreter. It should be at the bottom right of your screen.

 

Select Add New Interpreter and then Docker.

We already have a Dockerfile inside of our project so we can simply leave the settings as is. If you don’t see Docker on the Docker Server selection, select Create New and add the Server. For my instance, it was Docker on Windows.

Click Next and it will build the new image. Keep going through the default prompts until you get to the end. Allow PyCharm to switch to the new interpreter and you should see that the Docker service is running and that you have no more red marks in your code.

You can now continue using your Docker container from where we left off in the previous article.

 

 Python Series

Continue your Python Learning.

Python P1: Getting started with Python and Docker-Compose

The language that does it all

Python P1: Getting started with Python and Docker-Compose

In part zero of our Python basics series, explore why Python has become the language of choice for web apps, data science, automation, and AI. Unpack its readable syntax, massive ecosystem, and thriving community, and learn where it fits in your tech stack.

Python P2: PyCharm with a Docker Interpreter

Debug inside the container—directly from PyCharm.

Python P2: PyCharm with a Docker Interpreter

Part two of our Python + Docker series walks through configuring PyCharm to use a Docker interpreter. You’ll attach your IDE to a container, run and debug code inside it, and keep dependencies isolated while enjoying full IntelliSense and breakpoints.

Python P3: Your First Python Script

Write, run, repeat.

Python P3: First Python Script

Part three of our Python basics series guides you through writing, saving, and executing your first Python script. Set up a virtual environment, use the terminal, add simple input/output, and run the code on any OS.

Leave a Reply