-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django project debug in docker container doesn't start #2313
Comments
@jmejia32 Can you share the project you are encountering this issue in? Or at least the Docker and docker-compose files, tasks.json, and launch.json? Also, can you share the logs from the following places:
Debugging in Docker is done differently; the app is run by running Debugpy in the container, which is supposed to connect back to the host. It sounds like Debugpy may not be able to connect back to the host and so VSCode sits there waiting for the connection. If this is the case the "Python Debug Console" output probably has the most important info. EDIT: Ah, I see your launch and tasks in the bug in the VSCode repo, as well as the |
@bwateratmsft ok, here we go:
version: "3"
services:
django:
container_name: django
build:
context: .
user: deploy
restart: always
tty: true
volumes:
- .:/home/deploy/web
environment:
- LANG=es_CO.UTF-8
- DJANGO_ENV=prod
networks:
default:
ipv4_address: 172.19.0.2
networks:
default:
driver: bridge
ipam:
config:
- subnet: "172.19.0.0/16"
FROM bitnami/python:3.7-debian-9-prod
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
# MS ODBC
RUN install_packages curl gnupg2 apt-transport-https ca-certificates
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list && apt-get update
RUN ACCEPT_EULA=Y install_packages msodbcsql17 unixodbc-dev
# for uwsgi
RUN install_packages build-essential
# for requirements.txt
RUN install_packages libpq-dev default-jdk locales
RUN pip install --no-cache-dir --upgrade pip
RUN sed -i -e 's/# es_CO.UTF-8 UTF-8/es_CO.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
# For google-oauth api
RUN rm -r /opt/bitnami/python/lib/python3.7/site-packages/setuptools*
RUN pip install --no-cache-dir setuptools
COPY requirements.txt .
RUN pip install --no-cache-dir uwsgi && pip install --no-cache-dir -r requirements.txt
# for pyjasperreport
COPY core-2.2.jar /opt/bitnami/python/lib/python3.7/site-packages/pyreportjasper/jasperstarter/jdbc
WORKDIR /app
RUN useradd -ms /bin/bash -u 1000 appuser && chown -R appuser /app
USER appuser
COPY entrypoint.sh .
COPY server.yaml .
CMD [ "./entrypoint.sh" ] FYI, the menu entry Terminal > Python Debug Console doesn't appear |
@bwateratmsft Terminal output
|
@bwateratmsft No, I'm sorry for being a little dumb hahaha. And the entry keeps hidden for me: |
Hm, that's not good. Our debug launch config in launch.json resolves down to a Python configuration, so basically once the Docker container is started, we hand control over to the Python extension--they use |
Yep, there it is:
|
Everything looks pretty normal to me; I'm not able to reproduce at least on Windows. In theory it shouldn't matter the host OS. @int19h do you know what might be happening? It seems like the Python extension is not executing the Python debug command ( |
@jmejia32 I have one theory. I was able to get the same symptoms to reproduce if the Can you run this command and share the output? |
Yes, the output is |
I'm glad to help! This step shouldn't be necessary though 😕 The most likely explanation I can think of is that somehow our code to get that IP address failed. The exact command line we use is Do you have a custom shell configured in VSCode, and does the command with the above ordering/syntax/quoting still work on your OS? |
@bwateratmsft yeah, actually I use fish as default shell. The commands explained here works without issues. |
I found the root cause of this. The |
This is now fixed in Docker extension version 1.7.0. |
Redirected from microsoft/vscode#106561 (comment)
In vscode, when I start the debug in my local computed (no docker), debug starts completely but when I start debug with docker, the container builds and starts while vscode ui waiting for connection and never "starts" debugging process.
The text was updated successfully, but these errors were encountered: