Skip to content

Instantly share code, notes, and snippets.

@thetemplateblog
Forked from porjo/docker_LAMP.md
Created July 31, 2016 01:23
Show Gist options
  • Save thetemplateblog/fd4578ff5ecdc0918773905936306cf6 to your computer and use it in GitHub Desktop.
Save thetemplateblog/fd4578ff5ecdc0918773905936306cf6 to your computer and use it in GitHub Desktop.
Minimal Centos 6.4 LAMP stack running on Docker (Ubuntu 13.04 host). End result is running httpd and port 80 is forwarded through from host to container.

Installation

sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo apt-get install linux-image-extra-`uname -r`
sudo sh -c "curl http://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker

Grab Centos image from Docker repo

sudo docker pull centos

Start new container based on centos image

sudo docker run -i -t centos /bin/bash

Install LAMP packages inside container environment

$ yum install httpd php php-common php-cli php-pdo php-mysql php-xml php-mbstring mysql mysql-server
$ exit

Snapshot to a new image called LAMP

sudo docker commit 6751f9bcb5c5 LAMP

Run container in background and kick off Apache process

sudo docker run -d -p :80 LAMP /bin/sh -c "/etc/init.d/httpd start; tail -f /var/log/httpd/error_log &> /dev/null"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment