Skip to content

Instantly share code, notes, and snippets.

@ninetails
Created March 7, 2014 02:09
Show Gist options
  • Save ninetails/9403731 to your computer and use it in GitHub Desktop.
Save ninetails/9403731 to your computer and use it in GitHub Desktop.
docker with CentOS+LAMP (PHP 5.5 + Apache 2.4)
# to build
docker build --rm=true -t <your user>/centos-lamp . < Dockerfile
# to run
docker run -d -p 8080:80 -v <path to mount>:/var/www:ro <your user>/centos-lamp /bin/bash -c '/sbin/service mysqld start; /sbin/service httpd start; tail -f /var/log/httpd/error_log &> /dev/null'
FROM centos
MAINTAINER Ninetails - Carlos Kazuo
RUN rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
RUN curl -s http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo > /etc/yum.repos.d/epel-httpd24.repo
RUN yum install -y xterm git mysql mysql-server httpd24-httpd php55w php55w-common php55w-cli mysql mysql-server php55w-devel php55w-mcrypt php55w-mbstring php55w-mysqlnd php55w-pdo php55w-pecl-xdebug php55w-xml php55w-xmlrpc php55w-opcache
RUN /sbin/chkconfig --add httpd
RUN /sbin/chkconfig httpd on --level 235
RUN /sbin/chkconfig --add mysqld
RUN /sbin/chkconfig mysqld on --level 235
RUN echo "NETWORKING=yes" > /etc/sysconfig/network
RUN sed -i "s/^bind-address/#bind-address/" /etc/my.cnf
RUN ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
RUN /sbin/service mysqld start; /usr/bin/mysqladmin -u root password "123456"; /usr/bin/mysql -uroot -p123456 -e "CREATE DATABASE dev; CREATE USER 'dev'@'localhost' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON dev.* TO 'dev'@'localhost'; FLUSH PRIVILEGES;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment