-
Notifications
You must be signed in to change notification settings - Fork 2
Dev Container
Open the Dev Container configuration file located at .devcontainer/devcontainer.json
in the PyCharm editor.
On the left of the editor, in the gutter, you should see the Docker icon: or .
Upon clicking on the Docker icon, the following options appear (depending on the PyCharm version used):
- Create Dev Container and Mount Sources..., and
- Show Dev Containers.
If no Dev Containers have been created previously, select the former option and proceed to create a Dev Container, otherwise select the latter option to list the existing Dev Containers.
- If you select Create Dev Container and Mount Sources...,
a separate window (Building Dev Container) will open and
a Dev Container will be built according to the specification in the
devcontainer/Dockerfile
. - The system dependencies are installed, a user account (i.e. pydev) is created, and additional Python packages and Poetry are installed.
- Upon completion the status messages should read something like: 'Dev Container' has been deployed successfully and Environment is successfully prepared…
- Proceed by choosing your PyCharm installation, from the dropdown menu that appears at the top, and click Continue.
- A connection is established with the remote host and a new PyCharm window is opened.
- Skip the following subsection and proceed with the section: Continuing in the Dev Container.
-
If you select Show Dev Containers, a separate window appears where the existing (previously created) Dev Containers are listed by their name and status (i.e. either running or idle). In general, all docker containers (including idle ones) can be listed using:
docker ps -a
-
If they are idle they can be started by clicking on their name or on the play button. An idle (Dev) Container can also be started from the terminal:
docker container start <container-name>
A running Dev Container can be accessed from the terminal, accordingly:
docker exec -it <container-name> bash
The -i
flag stands for interactive session and the -t
stands for running it in the terminal.
- Proceed in the following section: Continuing in the Dev Container
Once you have accessed the Dev Container, change to the user pydev:
sudo -u pydev -i
And make sure to navigate to the project root folder:
cd /IdeaProjects/OpenSquirrel/
Continue to install the dependencies (if not done already in this container; otherwise you may skip this step):
poetry install
and initiating the Poetry shell environment:
poetry shell