There are three critical components to the Dockerfile that inherit our base_image. In the docker folder in the DCGAN directory, create a Dockerfile and complete the following steps:
- Import the base_image we've been using for each of our chapters using the following command:
FROM base_image
- As we are using the LSUN dataset, we are going to use the LSUN repository to download the raw data, as follows:
RUN git clone https://github.com/fyu/lsun.git
- There are a few miscellaneous installations that end up being useful for debugging (IPython) and visualization (pydot and graphviz), which can be run with the following commands:
RUN apt install -y python3-pydot python-pydot-ng graphviz
RUN pip3 install ipython
- Now, to build the Dockerfile, we need to create a build script (aptly called build.sh in DCGAN and docker), as follows:
#/bin/bash
nvidia-docker build -t ch4 .
- Next, implement a clean script to remove the image from your machine if necessary (this is stored in a file called clean.sh in DCGAN and docker) with the following code:
#/bin/bash
docker rmi ch4
- As with all shell scripts, ensure that each of them is executable prior to using them. You can do this with the following command:
chmod 777 <filename>.sh
# Replace filename with the name of the file you want to grant
executable privileges to
- Your directory structure should now look like the following:
DCGAN
├── data
│ └── README.md
├── docker
│ ├── build.sh
│ ├── clean.sh
│ └── Dockerfile
- Now, we have a Dockerfile and a build script, build the Docker image by issuing the following command:
sudo ./build.sh
Now, it's time to move on and download some data!