Code Monkey home page Code Monkey logo

lemp_docker's Introduction

Docker based web development environment based on a LEMP stack (NGINX, PHP7, MariaDb)

Reusable web development containers running NGINX, PHP7 as fpm, and MariaDb which is 100% compatible with MySQL.

You'll need to install Docker on your machine.

Then open a terminal to in LEMP_docker/ directory and run the following in the terminal

docker-compose up

This first time builds then starts up a webserver instance on port 80 (HTTP) and SSL on port 443 (HTTPS) using a self signed certificate, Mariadb and php-fpm v7 and leaves the terminal window tailing the logs from all instances.

When your done CTRL-C closes it all down gracefully.

Second time on the command just restarts the containers if nothing changed in the Docker files for the mages, if something has changed it will rebuild the images and containers.

When running in a web browser go to http://local.dev/ or http://127.0.0.1/ you'll need to be resolving local.dev or *.dev to 127.0.0.1

checkout dnsmasq to make your life easy and wild card *.dev.local to 127.0.0.1

Tweak domains, db usernames and passwords as required in the docker-compose.yml and/or Docker files and files included from the build/ sub directories.

Containers created are prefixed with the parent directory name eg. LEMP_docker becomes lempdocker_{contanerName}_1

e.g.

  • lempdocker_web_1
  • lempdocker_php_1
  • lempdocker_mysql_1

quick start docker-compose command guide

docker-compose when run applies it's actions to the containers as defined in the docker-compose.yml file of the current directory

docker-compose up -d          # Builds images if required and starts containers if not running
docker-compose up -d --build  # Build images before starting containers
docker-compose start          # Start containers, which must have been buiult previously
docker-compose stop           # Stop containers
docker-compose logs           # show logs from all containers
docker-compose logs -f        # Tail logs from all containers CTRL-C to stop tailing

quick start docker command guide

docker ps                             # show all running containers
docker ps -a                          # show all containers whether running or not
docker exec -ti {container_name} bash # open a bash shell in a running container
docker images                         # show all images (containers are an image with configuration)
docker rm {container_name_or_id}      # remove a container
docker rmi {image_id}                 # remove an image
docker rm $(docker ps -a -q)          # remove all containers
docker rmi $(docker images -q)        # remove all unused images, it'll error on the used one, leaving them in place

Local file layout

  • /Project-root directory
    • docker-compose.yml defines the container setup
    • /docker The individual container build scripts
    • /public website root directory for public assets etc
    • /other_dirs Other directories you want your app to have access to, e.g. containing the application controllers models etc

lemp_docker's People

Contributors

dave-barnwell-hf avatar davebarnwell 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.