Skip to content

This repository provides a simple template for running PHP and MySQL applications using Docker. Suitable for beginners and developers who need a quick, isolated, and consistent development environment setup.

License

Notifications You must be signed in to change notification settings

albertdveada/PHP-MySQL-Docker-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Logo

Running Docker for PHP & MySQL (Version 8.3)

This repository provides a simple template to run a PHP and MySQL application using Docker. Ideal for beginners or developers who need a fast, isolated, and consistent development environment.


✨ Key Features

  • Isolation: Avoid PHP/MySQL version conflicts on your host system.
  • Portability: Works across multiple operating systems without reconfiguration.
  • Quick Deployment: Set up your development environment with a single command.
  • Scalability: Easily extendable for production use.

πŸš€ Usage Steps

1. Instalasi Docker


2. Clone Repository & Run the Project

This repository contains basic configuration for running a PHP and MySQL application using Docker.

  1. Clone the repository:

    git clone https://github.com/albertdveada/Tutorial-Docker-PHP-MySQL.git
    
  2. Enter the project directory:

    cd Tutorial-Docker-PHP-MySQL
    
  3. Start Docker Compose: Run Docker Compose to start the containers in the background.

    docker-compose up -d
    
  4. Access the Application in Your Browser:

    Once the containers are up, you can access the services at:


3. Manage Containers

Use the following commands to manage your Docker container lifecycle:

  • Stop containers:
    docker-compose stop
  • Restart containers:
    docker-compose start
  • Remove containers, networks, volumes (for reset):
    docker-compose down -v
    

⚠️ MySQL Version Notes

  • MySQL 8.1+: Uses caching_sha2_password, by default. no additional config needed.

  • MySQL 8.0 or earlier: Use mysql_native_password. Uncomment the following line in docker-compose.yml:

    command: --default-authentication-plugin=mysql_native_password
    

πŸ“ File Structure:

πŸ“¦ Tutorial-Docker-PHP-MySQL/
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ index.php
└── README.md

πŸ”Ž Quick Overview:

  • docker-compose.yml: Defines all services (PHP, MySQL, phpMyAdmin).
  • index.php: Example PHP app you can test in the browser.
  • README.md: Full setup and usage guide for this project.

πŸ’‘ You can add folders like src/, config/, or public/ as your project grows.


Make sure your configuration matches the MySQL version you’re using. For more help, refer to the official Docker or MySQL documentation. Hope this tutorial helps! 😊

About

This repository provides a simple template for running PHP and MySQL applications using Docker. Suitable for beginners and developers who need a quick, isolated, and consistent development environment setup.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published