Pycharm에서 docker-compose를 통해 Python 콘솔 실행
docker-compose를 통해 원격 파이썬 인터프리터로 pycharm을 실행하는 데 문제가 있습니다. 실행 버튼을 누르면 Python 콘솔을 제외하고는 모든 것이 잘 작동합니다. 다음 메시지가 표시됩니다.
"오류 : docker-compose 출력에서"web "서비스에 대한 컨테이너 이름을 찾을 수 없습니다."
서비스를 docker-compose.yml제공하는 경우 왜 계속 표시되는지 이해할 수 없습니다 web.
도움이 필요하세요?
편집하다:
docker-compose.yml
version: '2'
volumes:
dados:
driver: local
media:
driver: local
static:
driver: local
services:
beat:
build: Docker/beat
depends_on:
- web
- worker
restart: always
volumes:
- ./src:/app/src
db:
build: Docker/postgres
ports:
- 5433:5432
restart: always
volumes:
- dados:/var/lib/postgresql/data
jupyter:
build: Docker/jupyter
command: jupyter notebook
depends_on:
- web
ports:
- 8888:8888
volumes:
- ./src:/app/src
python:
build:
context: Docker/python
args:
REQUIREMENTS_ENV: 'dev'
image: helpdesk/python:3.6
redis:
image: redis:3.2.6
ports:
- 6379:6379
restart: always
web:
build:
context: .
dockerfile: Docker/web/Dockerfile
command: python manage.py runserver 0.0.0.0:8000
depends_on:
- python
- db
ports:
- 8001:8000
restart: always
volumes:
- ./src:/app/src
worker:
build: Docker/worker
depends_on:
- web
- redis
restart: always
volumes:
- ./src:/app/src
Dockerfile
FROM python:3.6
# Set requirements environment
ARG REQUIREMENTS_ENV
ENV REQUIREMENTS_ENV ${REQUIREMENTS_ENV:-prod}
# Set PYTHONUNBUFFERED so the output is displayed in the Docker log
ENV PYTHONUNBUFFERED=1
# Install apt-transport-https
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https
# Configure yarn repo
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# Install APT dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
locales \
openssl \
yarn
# Set locale
RUN locale-gen pt_BR.UTF-8 && \
localedef -i pt_BR -c -f UTF-8 -A /usr/share/locale/locale.alias pt_BR.UTF-8
ENV LANG pt_BR.UTF-8
ENV LANGUAGE pt_BR.UTF-8
ENV LC_ALL pt_BR.UTF-8
# Copy requirements files to the container
RUN mkdir -p /tmp/requirements
COPY requirements/requirements-common.txt \
requirements/requirements-$REQUIREMENTS_ENV.txt \
/tmp/requirements/
# Install requirements
RUN pip install \
-i http://root:test@pypi.defensoria.to.gov.br:4040/root/pypi/+simple/ \
--trusted-host pypi.defensoria.to.gov.br \
-r /tmp/requirements/requirements-$REQUIREMENTS_ENV.txt
# Remove requirements temp folder
RUN rm -rf /tmp/requirements
이것은 파이썬 이미지 Dockerfile이고, 웹 Dockerfile은이 이미지에서 선언하고 소스 폴더를 컨테이너에 복사합니다.
나는 이것이 의존성 체인 문제라고 생각합니다 web. python따라서 python컨테이너가 올라갈 때 web여전히 존재하지 않습니다. 이로 인해 오류가 발생할 수 있습니다.
Cheers
Installing required libraries via command line and running the python interpreter from the PATH should suffice.
You can also refer to the JetBrains manual, as to how they have configured for the interpreters of their IDEs.
참고URL : https://stackoverflow.com/questions/42074583/run-python-console-via-docker-compose-on-pycharm
'Program Club' 카테고리의 다른 글
| HW kbd 키보드 포커스 iOS로 설정하지 못했습니다 (null). (0) | 2020.11.15 |
|---|---|
| Express-mysql-session으로 여권 deserializeUser가 실행되지 않도록 방지 (0) | 2020.11.15 |
| iframe에서 IE 11 자사 세션 쿠키가 손실 됨 (0) | 2020.11.15 |
| 클래스 탐색기없이 속성 맵에 속성을 추가하는 방법은 무엇입니까? (0) | 2020.11.15 |
| Rstudio 및 Google 드라이브 동기화 문제 : "다른 프로세스에서 사용 중이기 때문에 프로세스가 파일에 액세스 할 수 없습니다." (0) | 2020.11.15 |