Run a MySQL server using docker container

Run a MySQL server using docker container

This project teaches you below listed things

  1. A short visual difference between Infra virtualization technology and docker

  2. How to Install / Remove docker on a aws instance

  3. How to check the status of docker service running on AWS instance

  4. How to run docker commands without using sudo

  5. How to pull docker mysql image from Docker Hub

  6. How to create mysql server using docker container using mysql image

  7. How to check the running docker containers

  8. How to delete the docker containers after use

To install docker

sudo apt install docker.io

To remove docker along with its temp file

sudo apt purge docker.io

To check the docker running status

systemctl status docker

To check the docker container running

sudo docker ps

Or

docker ps

If you get the above error you need to get add the ubuntu user in docker group.

To check the groups

sudo cat /etc/group

Add the ubuntu user to the group 'docker'

sudo adduser ubuntu docker

Or

Sudo usermod -aG docker ubuntu

To pull the docker image from docker hub (it’s a repository)

Docker pull mysql:latest

To check the docker images

docker images

To run the mysql image

docker run mysql:latest

You will be getting prompt to specify mysql password as an environment variable.

Set it using below command.

docker run -e MYSQL_ROOT_PASSWORD=Test@123 mysql:latest

or

docker run -d -e MYSQL_ROOT_PASSWORD=Test@123 mysql:latest (run mysql container in background using '-d' parameter)

running the command docker run -e MYSQL_ROOT_PASSWORD=Test@123 mysql:latest will make your sql database server ready for connections

To check the sql server running with docker image, run the command

docker ps

To kill the docker running container

docker kill container_id