Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service name for Docker Compose remote interpreter in PyCharm 5.1 Beta 2

I've imported to PyCharm 5.1 Beta 2 a tutorial project, which works fine when I run it from the commandline with docker-compose up : https:// docs.docker.com/compose/django/

Trying to set a remote python interpreter is causing problems.

I've been trying to work out what the service name field is expecting: remote interpreter - docker compose window - http:// i.stack.imgur.com/Vah7P.png.

My docker-compose.yml file is:

version: '2'
services:
  db:
    image: postgres
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    depends_on:
      - db

When I try to enter web or db or anything at all that comes to mind, I get an error message: Service definition is expected to be a map

So what am I supposed to enter there?

EDIT1 (new version: Pycharm 2016.1 release)

I have now updated to the latest version and am having still issues: .IOError: [Errno 21] Is a directory

Sorry for not tagging all links - have a new user link limit

like image 440
Revlis Edial Avatar asked Nov 09 '22 18:11

Revlis Edial


1 Answers

The only viable way we found to workaround this (Pycharm 2016.1) is setting up an SSH remote interpreter.

Add this to the main service Dockerfile:

RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

Then log into docker container like this (in the code sample pass 'screencast'):

$ ssh [email protected] -p 2000

Note: We aware the IP and port might change depending on your docker and compose configs

For PyCharm just set up a remote SSH Interpreter and you are done!

https://www.jetbrains.com/help/pycharm/2016.1/configuring-remote-interpreters-via-ssh.html

like image 124
danius Avatar answered Nov 15 '22 05:11

danius