Dockerizing EmailHarvester

I was just hanging out on a Saturday night and I stumbled onto this tool called EmailHarvester. It runs on Python 3 and I still use Python 2.7 and didn’t want to deal with virutualenv and whatnot. I decided it might be a good time to learn how to Dockerize tools. This is nothing mind blowing or new but I haven’t done this before.

Creating the Dockerfile

First thing that needs to be done is to build a Dockerfile that will used to build the image:

Here is the break down line by line:

  1. Grabs the Docker image for Python3
  2. Adds the folder containing EmailHarvester
  3. Runs a command. In this case it was necessary to install the dependencies of the tool
  4. Tells the docker image what to do when ran

The important point was that I used ENTRYPOINT and not CMD. When you use ENTRYPOINT it allows you to pass arguments which I will show later in the article

For more information the documentation can be found here

Building the Docker image

To build the image runĀ  the following command:

docker build -t emailharvester .

Additionally you can add a label to the name (-t) by doing name:label. If you don’t add a label the default will be “latest”.

For more information the documentation can be found here

Running the Docker image

To run the Docker image do the following:

$ docker run -it emailharvester -d
[+] User-Agent in use: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1
[+] Searching everywhere
[+] Searching in ASK: 10 results
[+] Searching in ASK: 20 results
[+] Searching in ASK: 30 results
[+] Searching in ASK: 40 results
[+] Searching in ASK: 50 results

This runs the docker image in interactive mode and takes everything after the image name as an argument.

For more information the documentation can be found here


So there you go a Dockerized tool. This makes it really easy to deal with dependencies. For example you can send the image to a friend and they can run it with ease as long as they have Docker. It doesn’t matter what kind of system they are running. I think all tools should come with a Dockerfile to deal with dependency issues.

Post navigation