How to Build a Docker Container from Scratch
TL, DR: The docker of this article is hosted on my GitHub and DockerHub, which works with no problem on Matterports Mask R-CNN and my Mask R-CNN.
I finally finished the very first workable version of Docker image used on my Mask R-CNN project after some stumbles, and I consider I should write something down to memorize this exciting moment. So in this article, I will show how to build a Docker image of your own machine learning project by scratch so that you won’t have to worry about other guys won’t know how to set up the environment and make your project deployment more easier.
So let’s get started!
Before writing the container setting — Dockerfile
– we take a look of the packages needed in this project:
We then create a Dockerfile
with the following content:
As the basis of OS, I choose Ubuntu 16.04, and most of the packages used in my Mask R-CNN project are written pretty straightforward in Dockerfile
.
One package I have to mentioned specifically is opencv
because I would like to to the package from source.
After installing required packages, I clone the repo of my Mask R-CNN and build some binaries of it.
At the end of Dockerfile
, I set the working directory to /root
and start bash
.
At last, I push the Dockerfile
repo to my GitHub and link the repo with Docker Hub to build the Docker image automatically (you can see how to link your GitHub repo with Docker Hub from here).
That’s all, thanks for your reading.
If you feel this project helpful remember to star my Docker image project and give me some claps :)
If you still don’t get how to build your own machine learn Docker image or find some mistake or some suggestions in this article, please leave some comments to let me know :)