项目作者: shakaib-arif

项目描述 :
Single container docker LAMP stack using runit as an init scheme.
高级语言: Dockerfile
项目地址: git://github.com/shakaib-arif/docker-lamp.git
创建时间: 2020-01-27T14:50:14Z
项目社区:https://github.com/shakaib-arif/docker-lamp

开源协议:GNU General Public License v3.0

下载


Docker-LAMP

It’s a single container docker LAMP stack using runit as an init scheme for its processes. We are using runit so we can run multiple processes in our container which will be administered by it. If you want to learn more about runit then check out the following link of my runit docker container.

LAMP Usage

You can run the contianer by choosing any method of your preference.

  1. Docker Hub
  2. Source Code

1. Docker Hub

Pull the image from docker hub and run its container.

  1. docker pull shakaib/docker-lamp
  2. docker run -itd --name docker-lamp -p 8080:80 shakaib/docker-lamp
  3. docker exec -it docker-lamp bash
  4. # in the container terminal check the process
  5. ps aux

This command will downlaod the image from docker hub and create its container.

  1. docker run -itd --name docker-lamp -p 8080:80 shakaib/docker-lamp /boot
  2. docker exec -it docker-lamp bash
  3. # in the container terminal check the process
  4. ps aux

If you see both apache and mysql processes are running then open your internet browser and access this container by using public IP address of your Docker host http://127.0.0.1:8080
My docker host is on my PC hence I’m using localhost to access my wordpress website.

2. Source Code

Open your terminal and follow these instructions to checkout the source code and build the image yourself.

  1. cd ~
  2. git clone https://github.com/shakaib-arif/docker-lamp.git
  3. cd docker-lamp
  4. docker build -t shakaib/docker-lamp .
  5. docker run -itd --name docker-lamp -p 8080:80 shakaib/docker-lamp
  6. docker exec -it docker-lamp bash
  7. # in the container terminal check the process
  8. ps aux

Note: Make sure the port we are using is opened in case if there is any firewall involved. We are using port 8080 for our container, confirm if the port is opened by issuing this netstat -tuna | grep 8080 in the terminal. If it’s not open then check out this tutorial to open a port.

Reference

https://github.com/shakaib-arif/runsv/

https://www.cyberciti.biz/faq/linux-unix-open-ports/

https://www.linuxjournal.com/content/bash-trap-command

https://linuxhint.com/wait_command_linux/