GithubHelp home page GithubHelp logo

docker-lamp's Introduction

docker-lamp (ubuntu based)

A simple and mostly automatic LAMP setup. Well, actually it is more like a LNMP, as I use nginx in favour of apache, but everybody uses the term and in this context I doubt there are many usecases where it matters.

It is based on phusion's base docker image, as it takes care of service managment for me and is fine in terms of size.

It will download the phusion/baseimage image, install nginx, php-fpm and mysqld, configure them and install service scripts for runit to start them.

For a more detailed guide to setting up dev environments with docker, check out my blog post

Usage

You can either just pull the image from the docker index using:

docker pull alexanderjulo/lamp

or you can build the image yourself, using

docker build --rm -t <yourname>/lamp git://github.com/alexex/docker-lamp.git

I do not guarantee that the version on the docker index is up-to-date at all times, but it should be at most. If you want to be sure or are sure that it is not up-to-date build the image yourself (it's really quick, too).

Run a container with the new image using:

docker run -d <yourname>/lamp

Or

docker run -d alexanderjulo/lamp

If you just

Mount your web app under /srv/http using docker's -v switch to make the container serve it up. Use -p 80 to expose the container's port.

A real world example could look like this:

docker run -d -p 80 -v /vagrant/app:/srv/http -name app <yourname>/lamp

In this one docker is run in a vagrant machine and the app is in the vagrant shared folder in app. It will then be served by nginx/php-fpm in the container. Run docker ps to find out which port was assigned on the host. By accessing <host>:<assigned port> on the browser, you will be able to access your app.

Modify / Fork

If you need adjustments to configuration, rewrites or other stuff, you can fork my github repository and then build your fork by using the docker build command above. Just replace my repository with yours.

If you are happy to have your changes locally you can just run an image and commit the container changes to a new image or a new tag on the same image. Whatever your prefer. This approach is the only valid if you need data volumes to work.

Additional information

I have modified some configuration and most of the services to keep the setup as simple as possible without using systemd. As containers are one-purpose things everything just runs as root. You can check the sections below to find out what modifications I made where.

mysql

  • Access as root user with no password

nginx.conf

  • One server serving at localhost from /srv/http using php
  • Added daemon off to enable control by runit
  • All comments removed

php-fpm.conf

  • Added daemonize off to enable control by runit
  • Remove unnecessary settings & comments
  • Besides: all settings still default

php.ini

  • Commented out open_basedir restriction
  • Enabled mysql extension

docker-lamp's People

Contributors

alexanderjulo avatar

Watchers

 avatar  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.