Create MySql/Mongo Server with Docker in 10 minutes

Basic docker command

docker run …
docker ps -a
docker start “container_id”
docker stop “container_id”
docker rm “container_id” // need to stop before remove
docker exec -it “container_id” bash

Let’s start it

  1. Install docker : https://docs.docker.com/engine/install/
  2. Create containner

For MySQL : change “myname” and “password”

docker run --name myname -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql

For MongoDB : change “mongo_name”

docker run --name mongo_name -p 27017:27017 -d mongo

3. Show Container list

Docker ps -a

4. Test with MySQL GUI

Hostname : localhost
User : root
Password : password
Port : 3306

Create Session
Create database table and insert data
Query data

Finished !!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store