Building the Docker image

The Docker image we'll use here is based on our base_image, which we built in Chapter 2Data First, Easy Environment, and Data Prep. To build a Docker image, take the following steps:

  1. Create a Docker file and add the following line to inherit from base_image:
FROM base_image
  1. Install a few dependencies for the Python and Kaggle libraries with the following code:
# Installations for graphing and analysis
RUN apt update && apt install -y python3-pydot python-pydot-ng graphviz
RUN pip3 install kaggle ipython pillow
  1. From the previous exercise, copy kaggle.json into the Docker container, as follows:
# Copy Kaggle.json
COPY kaggle.json ~/.kaggle/kaggle.json
  1. Download the data using the Kaggle API into the /data folder, as follows:
# Download the Data
#https://www.kaggle.com/c/mp18-eye-gaze-estimation/data
RUN kaggle datasets download -d 4quant/eye-gaze -p /data/
  1. Move the working directory to the /data folder and then unzip the data into the folder, as follows:
WORKDIR /data
RUN unzip eye-gaze.zip -d eye-gaze
RUN rm eye-gaze.zip
Remember to remove eye-gaze.zip to save space.
  1. Set the working directory for the Docker container with the following. This will be used when we want to run code:
WORKDIR /src
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.210.91