DEV Community

Mallikarjun H T
Mallikarjun H T

Posted on

MySQL with Adminer with docker

The way software is developed has been transformed by the emergence of DevOps. Continuous integration and continuous delivery (CI/CD), two DevOps methods, have made it feasible to deliver software more quickly and consistently. We'll discuss Dev Containers, Docker, why it's important to learn Docker, and Docker's benefits in this blog.

What are Dev Containers and Docker?

Dev Containers are pre-configured development environments that run in Docker containers. Dev Containers are designed to be lightweight and portable, allowing developers to work on their projects without worrying about dependencies or conflicts with their local machine. Developers can easily switch between different Dev Containers, each with its own set of tools and configurations.

Why it's essential to learn Docker

Docker training is required for any developer who want to work in a modern software development environment. Docker has become the de facto containerisation standard, with millions of developers worldwide using it. Here are a few reasons why learning Docker is critical:

  1. Portability: Docker allows applications to be packaged in containers that can operate anywhere, making it easier to deploy apps across several settings.

  2. Consistency: Docker guarantees that software run reliably across environments, lowering the chance of errors and conflicts caused by different versions of libraries and dependencies.

  3. Scalability: Docker makes it simple to scale up or down apps, allowing them to handle increased traffic or strain.

  4. Flexibility: Docker's flexibility allows developers to experiment with various settings and environments without affecting their local system.

Writing the docker compose File

version: docker-version

services:
  mysqldb: #image name
    image: mysql:8 # image with what version default is latest
    container_name: mysqldb
    ports:
      - 3306:3306 # port on local machine : port on container
    volumes:
      - mysqlDbVolume:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=SOME_PASSWORD
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

volumes:
  mysqlDbVolume:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: path/to/local/directorey

Enter fullscreen mode Exit fullscreen mode

to access Adminer in browser open localhost:8080

enter image name
user name is root by default
password is SOME_PASSWORD mentioned in docker file
select your DB

then login

To run the container

docker-compose up this will bring your container UP

to stop

docker-compose down

to run as detached add -d when you make a container UP

Conclusion

Dev Containers and Docker are essential technologies for modern software development. Docker's portability, consistency, scalability, flexibility, and security make it a key technology for DevOps practices, including continuous integration and continuous delivery. By learning Docker, developers can build, package, and deploy applications with greater efficiency and reliability, making it a valuable skill for any developer to have.

Top comments (1)

Collapse
 
mallikarjunht profile image
Mallikarjun H T

you can also refer to this github for more details
GitHub