I am trying to access Flask app from the Docker compose getting started tutorial from my local host but without making changes to this pruned Dockerfile:
# syntax=docker/dockerfile:1
FROM python:3.9-alpine
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
This if my docker-compose.yml:
version: "3.9"
services:
web:
build: .
command: flask run
volumes:
- type: bind
source: .
target: /code
environment:
- ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
ports:
- target: 5000
published: 8000
networks:
- counter-net
redis:
image: "redis:alpine"
networks:
- counter-net
networks:
counter-net:
volumes:
volume-net:
When I use docker compose up I can see: Running on http://127.0.0.1:5000 but I cannot access it on Running on 127.0.0.1:8000 or localhost:8000
I can see 2_counter-net when I list networks and if relevant earlier I tried creating a volume but removed this when I changed the source to . and it came up without error.
How can I correct my config please?