Posts

Showing posts with the label PHP/MySQL

Deploy A simple and practical example for a PHP/MySQL in Docker Container

  There is many way to deploy PHP code with MySQL in Docker Environment.We will start from scratch i.e. from without customize Images to Customize images with Docker compose. There are Following steps Basic Requirement s: PHP code and MySQL dump file, You can download the code from  https://github.com/vineetkumar03/php_mysql_demo.git Please read the instruction to run PHP code without Docker. DB connection needs Environment variable to run the code. To run in docker environment put all PHP code in src Directory. To Communication with web and db via two methods :  1. Link method (Link PHP container with MySQL container’s name)  2. With Same Network (Create a docker network and run both container same network) Run it From Basic Docker Commands using Base Images:  Use Docker basic commands run PHP with MySQL using link method with name. FOR DATABASE: docker run --name db -v register.sql:/docker-entrypoint-initdb.d/ -e MYSQL_USER=tests -e MYSQL_PASSWORD=tes...