Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Docker compose Flask and Redis

pip install docker-compose
version: '3.8'
services:
  web:
    build: .
    ports:
    - "5001:5000"
    volumes:
    - .:/opt
    links:
    - redis
  redis:
    image: redis:6.0.8
FROM python:3.8

COPY requirements.txt /opt/
RUN pip3 install -r /opt/requirements.txt

WORKDIR /opt

ENV FLASK_APP=app
ENV FLASK_DEBUG=1
CMD  ["flask", "run", "--host", "0.0.0.0", "--port", "5000"]

docker-compose up
  • http://localhost:5001/