Docker + Port Scraper
This post is part of a series of a simple networking scanning tool named PortScraper. I will explain how to embed the application into Docker image and how to prepare the setup (PortScraper + MariaDB) with docker-compose.
If you want to follow the next steps you will need Git, Docker and Docker-compose installed.
Lets begin, open a terminal and navigate to the directory where you want to clone the project and clone the project:
git clone https://github.com/ddavidmelo/port_scraper.git
After cloning the project, you can start playing around with Docker. To run a docker application is necessary to build a Docker image from a Dockerfile like this one from the project that you cloned:
1 |
|
Since this project depends on a database to run, it will be easier to use Docker Compose. Docker Compose is a utility that allows you to set up and run multiple Docker containers as a single application. It allows you to create a configuration file in YAML format that defines the services your application requires. You can then use a single command to bring all of those services up and running at once, based on the configuration you’ve provided. So take a look at this docker-compose.yml:
1 |
|
After running docker-compose up
(or make up
) a config.toml file will be created in the config folder and you can change the file_path to a different one (like this geolite2-city-ipv4.csv.gz.) or other parameters.
I hope this tutorial helped everybody to get started with the port scraper application or to apply this concepts in other projects.