Part 1 — Remote Developing with PyCharm [Docker SSH Server]
In this part, you will learn how to start developing using PyCharm and Docker.
Last updated
In this part, you will learn how to start developing using PyCharm and Docker.
Last updated
The first thing you need to do is to create a directory in which you can store docker and ssh related files.
As an example, we will create a directory named remote_dev inside our project and move into that directory with the command:
On your client system – the one you’re using to connect to the server – you need to create a pair of key codes.
To generate a pair of SSH key codes, enter the command:
Files my_key
and my_key.pub
will be created in the working directory.
Let's create all the files necessary for building the container.
1. Create Dockerfile
Let's create a simple image in which we will deploy the SSH server:
remote_dev/Dockerfile
Add a script to start the server:
remote_dev/sshd_daemon.sh
2. Create docker-compose
Since we need a GPU inside the container, we will take Image with pre-installed CUDA as a basis and set runtime to nvidia. For convenience, let's create a docker-compose file:
remote_dev/docker-compose.yml
3. Build container
Don't forget to install docker and nvidia-docker2
The basic syntax used to build an image using a docker-compose is:
Once the image is successfully built, you can verify whether it is on the list of containers with the command:
Add server with the ports specified in docker-compose.yml
~/.ssh/config (example)
To connect to container by SSH, use command:
Open Preferences -> Python Interpreter
Show all
Plus button
3. Configure interpreter
4. Run simple code