sachaamm / dockerized-samples

A basic dockerized Lamp project for php 7.2 + MySql + phpmyadmin. It's an easy way to easily dockerize my old-style Php Websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dockerized Samples

Some samples to share my training on Docker to deploy fastest as possible Websites environnement.

LAMP MySQL ( Php7.2 + Apache2 + MySql + PhpMyAdmin )

A basic dockerized Lamp project for php 7.2 + MySQL + PhPMy@dmin. It's thought as an easy way to dockerize my old-style Php Websites :-)

/etc/init.d/mysql stop   # you must stop your MySql service running on port 3306 to let docker run MySql
sh stopAndRemoveContainers.sh  # we clean containers by stopping them and removing all containers. 
cd LAMP-MySQL/ && docker-compose up # we build containers with docker-compose file. 

Now, your website folder is reachable here :
http://localhost:8080/

And your phpMyAdmin interface is reachable here ( password is defined in your docker-compose.yml file ) :
http://localhost:4002/ ( Credentials: User >> root / Password >> example )

NodeJS + Express ( NodeJS10 + Express4.16 )

A basic NodeJS middleware app using Express running in a Docker container. In this sample, I show you 2 ways to launch your container, from cli, and from docker-compose. Thanks to theses relevant articles.
https://nodejs.org/de/docs/guides/nodejs-docker-webapp/
https://medium.com/@nbanzyme/easy-way-to-install-nvm-on-ubuntu-18-04-2cfb19ee5391

Using Docker cli & Dockerfile

cd NodeJS-Express
sh launchNodeContainer.sh  # open the shell script for more info

Result : http://localhost:8081/

Using Docker-compose

cd NodeJS-Express
docker-compose up

Result : http://localhost:8082/

I'm passing env argument with node to specify if the container is built from docker-compose or from docker-cli with a Dockerfile. There are also bunch of useful commands you can use :

# Get container ID
docker ps

# Print app output
docker logs <container id> 
# Output expected : Running on http://localhost:8080

# Enter the container
docker exec -it <container id> /bin/bash 

Symfony and MariaDB

See you there

About

A basic dockerized Lamp project for php 7.2 + MySql + phpmyadmin. It's an easy way to easily dockerize my old-style Php Websites


Languages

Language:PHP 86.1%Language:HTML 10.5%Language:JavaScript 1.7%Language:Shell 0.9%Language:Dockerfile 0.7%