Course Content
Docker for Python Developers
Docker for Python Developers
Dockerfile for a simple Flask Project
To package our project into a Docker container, we need an additional command: WORKDIR
.
The WORKDIR
command in Docker sets the working directory for any subsequent instructions in the Dockerfile. In your case, WORKDIR /flask-app
sets /flask-app
as the working directory.
This means that any further instructions (such as COPY
, RUN
, CMD
, etc.) will be executed in the context of this directory. For example, if you execute COPY app.py /flask-app
, the file app.py
will be copied into the /flask-app
directory inside the container.
This is useful for organizing your project within the container and ensuring clarity about where operations are taking place within the Docker image.
Thanks for your feedback!