To complete this step, you need to complete following tasks:
Task 1 : Create Dockerfile
To complete this task, you need to copy the following code:
FROM python:3.4-alpine WORKDIR /code COPY app.py /code RUN pip install flask redis CMD ["python", "app.py"]
This tells Docker to:
- Build an image starting with the Python 3.4 image.
- Set the working directory to /code.
- Copy the file app.py into the path /code in the image.
- Install the Python dependencies.
- Set the default command for the container to python app.py.
Task 2 : Run Docker Build
Using the docker build command to build the image. You can give the image a friendly name by using the
-t <image_name> option.
To complete this task you need to execute the following code:
docker build --tag flask-redis-app .