1

I'm using jupyter notebooks to prototype and I write the majority of my code as python packages using vscode and installed as so:

pip install -e .

This works well as I can test rapidly prototype in jupyter but still maintain reusable / testable code by keeping most of the heavy lifting in the package(s)

I'd like to move my python/jupyter environment to docker. Is there any way to configure vscode to work well with a "remote" development environment running in a docker container?

1
  • There is the docker extension in marketplace, which allows you to easily attach shell to the containers. You can then run your python code in the vscode terminal as per usual. But for remote interpreter, I think they are still working on it according to this issue Commented Jan 3, 2019 at 14:41

2 Answers 2

3

Since May 2019 (version 1.35), VScode remote development feature is present in the stable release. It splits the VScode program in two:

  • a server part that can be runned on a remote computer, container, or WSL environment
  • a client part, mainly the GUI, that is runned locally

When properly configured, debugging/linting/... operations will be executed inside the container. To answer your specific question, you can get a debug experience identical the one of an uncontainerized setup.

See here for a quick overview of this feature. You can find a vscode-issued tutorial on how to setup vscode with docker here.

Sign up to request clarification or add additional context in comments.

Comments

0

If you expose the Jupyter instance running in the container to your machine, you may be able to specify it as a remote Jupyter server.

3 Comments

Thanks @Brett, but I just want to be able to run/debug standard python scripts in vscode using a python interpreter running in docker. I'm using pyenv instead (not with docker) and that seems to work pretty well - I've created an environment which I use for both jupyter and simple scripts
I believe you can set up remote debugging into the Docker container.
Thanks, that looks promising

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.