You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the container with F5 it just seems it just runs the "dummy" python interpreter but not actually the flask app.
If I exec -it /bin/bash into the container and run "python -m flask run --host 0.0.0.0 --port 8090" I can connect to the service and it works fine (of course without debugging).
Outputs:
Output: empty
Debug console: empty
Terminal 1: empty
Terminal 2:
> Executing task: docker-run: debug <
> docker run -dt -P --name "gisapi-dev" -e "FLASK_APP=gisapi/__init__.py" -e "FLASK_ENV=development" --label "com.microsoft.created-by=visual-studio-code" -v "/home/mtoman/geoserver/gisapi:/app" -v "/home/mtoman/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/lib/python/debugpy:/debugpy:ro" -p "8090:8090/tcp" --entrypoint "python" "gisapi:latest" <
fb4ff5976e9b6b7030d8dae81c6ec23ae6cd654aef443b224cf13a05ac1dd968
Terminal will be reused by tasks, press any key to close it.
Terminal 3 (Python Debug Console): empty
At first I did not use docker-compose, after reading a few issues here I added the files as following and performed "compose up" on docker-compose.debug and then F5, but same result:
Do I need docker compose?
If I run "compose up" it just gives me
> Executing task: docker-compose -f "docker-compose.debug.yml" up -d --build <
Pushing the restart button gives me "There is already a debug configuration "Docker: Python - Flask" running.
Pushing stop seems to stop whatever it is doing in VS code but the docker container is still running (probably supposedly so?)
docker inspect bridge --format="{{(index .IPAM.Config 0).Gateway}}"
gives me 172.17.0.1
# For more information, please refer to https://aka.ms/vscode-docker-python
#FROM python:3.8-slim-buster
FROM python:3.6
RUN apt-get update
RUN apt-get install -y apt-utils
# TODO: fix versions
RUN apt-get install -y libgdal-dev
RUN apt-get install -y libmapnik-dev
RUN apt-get install -y mapnik-utils
RUN apt-get install -y libboost-python-dev gcc
RUN pip install flask
RUN pip install pygdal==`gdal-config --version`.*
RUN pip install owslib
RUN pip install psycopg2-binary
RUN pip install gevent
#== mapnik
# TODO archive not maintained, get via git clone?
RUN wget https://github.com/mapnik/python-mapnik/archive/v3.0.16.tar.gz && \
tar -xf v3.0.16.tar.gz && rm v3.0.16.tar.gz && \
cd python-mapnik-3.0.16 && \
python setup.py install
EXPOSE 8090
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
# Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights
RUN useradd appuser && chown -R appuser /app
RUN touch /var/log/gisapi.log && chown appuser /var/log/gisapi.log
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "-m", "flask", "run", "--host", "0.0.0.0", "--port", "8090"]
/Hi,
I've encountered the same issue as in #2313 and was not able to resolve it yet.
I am also on Linux but running a Flask app in a docker container.
Followed along https://code.visualstudio.com/docs/containers/debug-python#_for-flask-apps and ended up with:
launch.json
tasks.json
When I run the container with F5 it just seems it just runs the "dummy" python interpreter but not actually the flask app.
If I exec -it /bin/bash into the container and run "python -m flask run --host 0.0.0.0 --port 8090" I can connect to the service and it works fine (of course without debugging).
Outputs:
Output: empty
Debug console: empty
Terminal 1: empty
Terminal 2:
Terminal 3 (Python Debug Console): empty
At first I did not use docker-compose, after reading a few issues here I added the files as following and performed "compose up" on docker-compose.debug and then F5, but same result:
Do I need docker compose?
If I run "compose up" it just gives me
Pushing the restart button gives me "There is already a debug configuration "Docker: Python - Flask" running.
Pushing stop seems to stop whatever it is doing in VS code but the docker container is still running (probably supposedly so?)
docker inspect bridge --format="{{(index .IPAM.Config 0).Gateway}}"gives me
172.17.0.1And docker inspect:
Thanks!
EDIT: Dev.Dockerfile:
EDIT2:
ping 172.17.0.1 and ping 172.17.0.2 works.