Docker compose Flask and Redis



pip install docker-compose


examples/flask-redis/docker-compose.yml
version: '3.7'
services:
  web:
    build: .
    ports:
    - "5001:5000"
    volumes:
    - .:/opt
    links:
    - redis
  redis:
    image: redis:5.0.5
    container_name: my-redis

examples/flask-redis/Dockerfile
FROM ubuntu:20.04
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y python3

RUN apt-get install -y python3-pip

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

WORKDIR /opt
CMD FLASK_APP=app FLASK_DEBUG=1 flask run --host 0.0.0.0 --port 5000

docker-compose up