Docker MySQL, PostgreSQL, and MongoDB

Docker MySQL, PostgreSQL, and MongoDB

Learn how to use Docker to install MySQL, PostgreSQL, and MongoDB

Introduction

In this short tutorial, you will learn how to install MySQL, PostgreSQL, and MongoDB using Docker. If you do not have Docker installed you can down it here.

MySQL

Run the following command to install the latest version of MySQL:

docker container run -p 3306:3306 --name mysql-example \ 
-v /path/local/host:/var/lib/mysql 
-e MYSQL_ROOT_PASSWORD=0123456789 -d mysql

PostgreSQL

Run the following command to install the latest version of PostgreSQL:

docker container run -d -p 5432:5432 --name pg-example \
-v /path/on/host:/var/lib/postgresql/data 
-e POSTGRES_DB=databaseName -e POSTGRES_PASSWORD=0123456789 postgres

MongoDB

Run the following command to install the latest version of MongoDB:

docker container run --name mongodb-example 
-v /path/local/host:/data/db 
-d -p 27017:27017 mongo

Conclusion

In this short tutorial, you learned how to install three different databases using Docker.

Did you like it? Why don't you try also...

Quickly Spin Up PostgreSQL With Docker Compose

Quickly Spin Up PostgreSQL With Docker Compose

Learn How to Install PostgreSQL Using Docker Compose

Using Makefiles For Go (GoLang) Development

Using Makefiles For Go (GoLang) Development

Learn how to run, build and, compile Go (GoLang) Applications for any Platform and Operating System using a Makefile

How to Convert GoLang Integer to String Conversion

How to Convert GoLang Integer to String Conversion

Learn how to convert integers to strings and how to convert strings to integers in GoLang