Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active November 21, 2019 09:54
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save porjo/6523155 to your computer and use it in GitHub Desktop.
Save porjo/6523155 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