As a memorandum when you want to easily build a flask environment.
test/
|- Dockerfile
|- docker-compose.yml
|- app/
|- app.py
Dockerfile
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install python3 python3-pip -y
RUN pip3 install flask
RUN mkdir /app
docker-compose.yml
Define the following procedure in this file.
build
: Create an image based on the Dockerfile in the specified pathcommand
: Command to be executed in the container after starting the containervolumes
: Mount local ./app
to / app
in the containerports
: Specify portversion: '3'
services:
web:
build: .
command: python3 app/app.py
volumes:
- ./app:/app
ports:
- 5000:5000
app/app.py
Now you are ready.
$ docker-compose up -d
$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------
test_web_1 python3 app/app.py Up 0.0.0.0:5000->5000/tcp
Recommended Posts