Giter Club home page Giter Club logo

docker-lamp's Introduction

Docker-LAMP

This repository goal is to create a docker container and compose: Centos, Apache, PHP and PDO DBLIB, MySQL


Docker Compose

First, we create a file named docker-compose.yml. On that file we will define two services "web" and "db" The "web" service will use the Dockerfile for our Apache/PHP container.

docker-compose.yml

  • The "db" service will use the Dockerfile for our MySQL container.
  • For the root user we are using the password "root". You may want to use a more secure password.
  • We also use the port 3306 to access the MySQL server from the host machine. If you already have another instance of MySQL running, you may need to use a different port. (i.e. "4001:3306")

Dockerfile for Web Server


Dockerfile for Database Server


Build and Start the Containers

Open a terminal window, navigate to the folder with the docker-compose.yml file, and type the following command.

docker-compose up -d

After the containers have finished building, we can check the logs with the following command:

docker-compose logs

Stop the Containers

docker-compose stop

Remove the Containers

docker-compose down



Build

Create Docker Image.

docker build -t <image_name> .

Run

Create Docker Container.

docker run -tid -p 4000:80 --name=<container_name> -v /path_to/folder:/var/www/html <image_name>

Replace <container_name> with the name you want for the container, and <image_name> with the name of the image you specified on the Build command above.


Example.

docker run -tid -p 4000:80 --name=container_apache -v /path_to/folder:/var/www/html image_apache

Also change "/path_to/folder" with the actual location of your website's root folder on your local machine.


Test Class

Open the http://localhost:4000/ url on your browser.

Test Connection

Open the http://localhost:4000/test.php url on your browser.

docker-lamp's People

Contributors

rhalp10 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.