Empowering App Development for Developers | Docker

At the beginning of the development a project, we are often bothered with the installation of programming languages, dependency libraries, third party services (databases, packages) etc. If there are many team members the process must be documented so that the environment for all developers is as expected. …

Photo by Caspar Camille Rubin on Unsplash

Hello friend, in this article we gonna learn how to initialize mysql database in docker container using docker compose.

make sure you was installed docker before, check using command

$docker -v
Docker version 20.10.8, build 3967b7d

Create directory to store docker-compose file

$mkdir databases/mysql
$cd databases/mysql

Creating docker compose yml file

$touch docker-compose.yml

Open docker-compose file

$nano docker-compose.yml

Edit docker-compose file

version: '3.1'
image: mysql
container_name: mydb
command: --default-authentication-plugin=mysql_native_password
restart: always
- ./data:/var/lib/mysql
MYSQL_PASSWORD : mypassword
- 3306:3306


Lets build container

docker-compose up -d

Check container using command

$docker-compose psmydb   docker-entrypoint.sh --def ...   Up - 3306/tcp,:::3306->3306/tcp, 33060/tcp

Testing Client …

Robioki Denis

DevOps Engineer & Fullstack Developer, someone who has a high curiosity 😁

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