1.2.1 - Introduction to Docker
Last updated Jan 22, 2025
What is...
Building a Container Image
1
2
Resources
Not found
Last updated
Last updated Jan 22, 2025
Last updated
import sys
import pandas as pd
print(sys.argv)
day = sys.argv[1]
# some pandas things
print(f'Finished for day {day}')from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"FROM python:3.12.8
RUN pip install pandas
WORKDIR /app
COPY pipeline.py pipeline.py
ENTRYPOINT ["python", "pipeline.py"]# syntax=docker/dockerfile:1
FROM ubuntu:22.04
# install app dependencies
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip install flask==3.0.*
# install app
COPY hello.py /
# final configuration
ENV FLASK_APP=hello
EXPOSE 8000
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]docker build -t {image_name}:{tag_name} .docker run -it {image_name}:{tag_name}