• AWS
About Me

MySQL is one of the most common open source databases available today. We are going to go through how to install MySQL using Docker. If you need refreshing on how to install Docker on ubuntu read this. If you need a refresher on why Docker is important, and what some of the possibilities are, read this.

This post is going to assume that you have already installed Docker on Ubuntu. It’s important to note here: I usually prefer using a PaaS service for databases in general such as AWS RDS. But, this is a very good lesson on easily installing MySQL.


Keep us logged in as root

sudo su


Download the MySql image from Docker

docker pull mysql:latest

Next we want to start MySQL

docker run --name test-mysql -e MYSQL_ROOT_PASSWORD='test' -d mysql

This is pretty self explanatory, everything behind the –name tag is the name of the container that will be created. The -d tag allows us to choose which image we want to run.

Once the you get the MySQL container running, you can double check the status and container ID

 docker ps -l 


Installing MySQL into a container gives you amazing flexibility in future tasks. It’s very easy to migrate to other machines, or scale horizontally.