Run MySQL in Docker Container

Docker changed my approach to software development for many aspects. One of them is how I maintain software dependencies on my developer's machine. I use Docker to install and configure my dependencies, usually required for testing my application.

Docker provides a repeatable process for creating an isolated environment which has the expected configuration. A very common use case is represented by installing a database, such as MySQL or PostgresSQL, creating schemas and users, and populating tables.

Docker helps in automating my process and it can be combined easily with CI/CD tools. We can easily run Docker as part of a Jenkins pipeline or we can run Docker with Apache Maven when building a Java application or any JVM based application.

Compile code with Docker

Every time I need to compile some code which I downloaded on the Internet, I have to spend a lot of time installing tools and libraries. Sometimes I need to cross-compile code or patch a library, and I need to configure some local environment which occupies space on my disk, but I can't throw away because I might need it again later.

What if I could easily and reliabily create the environment when I need?

Docker represents a versatile tool which can help to simplify and eliminate tedious operations such as preparing an environment for compiling code. This principle can be extended to any build process, and actually there are already companies such as CircleCI, which have adopted Docker for their CI/CD solution.