当前位置: 首页 > 软件库 > 数据库相关 > >

docker-compose-lamp

授权协议 MIT License
开发语言 PHP
所属分类 数据库相关
软件类型 开源软件
地区 不详
投 递 者 锺离赤岩
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

LAMP stack built with Docker Compose

Landing Page

A basic LAMP stack environment built using Docker Compose. It consists of the following:

  • PHP
  • Apache
  • MySQL
  • phpMyAdmin
  • Redis

As of now, we have several different PHP versions. Use appropriate php version as needed:

  • 5.4.x
  • 5.6.x
  • 7.1.x
  • 7.2.x
  • 7.3.x
  • 7.4.x
  • 8.0.x

Please note that we simplified the project structure from several branches for each php version, to one centralized master branch. Please let us know if you encouter any problems.

Installation

  • Clone this repository on your local computer
  • configure .env as needed
  • Run the docker-compose up -d.
git clone https://github.com/sprintcube/docker-compose-lamp.git
cd docker-compose-lamp/
cp sample.env .env
// modify sample.env as needed
docker-compose up -d
// visit localhost

Your LAMP stack is now ready!! You can access it via http://localhost.

Configuration and Usage

General Information

This Docker Stack is build for local development and not for production usage.

Configuration

This package comes with default configuration options. You can modify them by creating .env file in your root directory.To make it easy, just copy the content from sample.env file and update the environment variable values as per your need.

Configuration Variables

There are following configuration variables available and you can customize them by overwritting in your own .env file.


PHP


PHPVERSIONIs used to specify which PHP Version you want to use. Defaults always to latest PHP Version.

PHP_INIDefine your custom php.ini modification to meet your requirments.


Apache


DOCUMENT_ROOT

It is a document root for Apache server. The default value for this is ./www. All your sites will go here and will be synced automatically.

APACHE_DOCUMENT_ROOT

Apache config file value. The default value for this is /var/www/html.

VHOSTS_DIR

This is for virtual hosts. The default value for this is ./config/vhosts. You can place your virtual hosts conf files here.

Make sure you add an entry to your system's hosts file for each virtual host.

APACHE_LOG_DIR

This will be used to store Apache logs. The default value for this is ./logs/apache2.


Database


DATABASEDefine which MySQL or MariaDB Version you would like to use.

MYSQL_DATA_DIR

This is MySQL data directory. The default value for this is ./data/mysql. All your MySQL data files will be stored here.

MYSQL_LOG_DIR

This will be used to store Apache logs. The default value for this is ./logs/mysql.

Web Server

Apache is configured to run on port 80. So, you can access it via http://localhost.

Apache Modules

By default following modules are enabled.

  • rewrite
  • headers

If you want to enable more modules, just update ./bin/phpX/Dockerfile. You can also generate a PR and we will merge if seems good for general purpose.You have to rebuild the docker image by running docker-compose build and restart the docker containers.

Connect via SSH

You can connect to web server using docker-compose exec command to perform various operation on it. Use below command to login to container via ssh.

docker-compose exec webserver bash

PHP

The installed version of php depends on your .envfile.

Extensions

By default following extensions are installed.May differ for PHP Verions <7.x.x

  • mysqli
  • pdo_sqlite
  • pdo_mysql
  • mbstring
  • zip
  • intl
  • mcrypt
  • curl
  • json
  • iconv
  • xml
  • xmlrpc
  • gd

If you want to install more extension, just update ./bin/webserver/Dockerfile. You can also generate a PR and we will merge if it seems good for general purpose.You have to rebuild the docker image by running docker-compose build and restart the docker containers.

phpMyAdmin

phpMyAdmin is configured to run on port 8080. Use following default credentials.

http://localhost:8080/
username: root
password: tiger

Redis

It comes with Redis. It runs on default port 6379.

Contributing

We are happy if you want to create a pull request or help people with their issues. If you want to create a PR, please remember that this stack is not built for production usage, and changes should good for general purpose and not overspecialized.

Please note that we simplified the project structure from several branches for each php version, to one centralized master branch. Please create your PR against master branch.

Thank you!

Why you shouldn't use this stack unmodified in production

We want to empower developers to quickly create creative Applications. Therefore we are providing an easy to set up a local development environment for several different Frameworks and PHP Versions.In Production you should modify at a minimum the following subjects:

  • php handler: mod_php=> php-fpm
  • secure mysql users with proper source IP limitations
  • Docker-compose 服务编排: 应用编排: 单机环境下:shell/python脚本 多机/集群环境下:ansible、saltstack、pubbet docker容器编排: 单机:docker-compose 多机/集群:docker swarm,mesos+ marathon,kubernetes 一、Docker-Compose简介 1.1 什么是Docker-Compose 我

  • 目录 一、Docker-Compose 1 为什么使用 Docker-compose 2 Docker-compose概述 二、compose 部署 1 Docker Compose 环境安装 2 YAML文件格式及编写注意事项 2.1 YAML文件格式 2.2 使用YAML时需要注意下面事项 2.3 数据结构 3 Docker Compose 配置常用字段 4 Docker Compose 常用

  • 目录结构: - docker-compose.yml - nginx * conf + nginx.conf + conf.d + default.conf * log * Dockerfile * run.sh - php * conf + php-fpm.conf + php-fpm.d + www.conf + zz-

  • 使用docker-compose部署简单的lamp环境 第一版: version: '3' services: nginx: image: nginx:latest networks: - mylnmp ports: - "8080:80" links: - "mysql" volumes: - /root

  • 基于Docker-compose.yml部署lnmp 安装docker-compose [root@node1 ~]# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 相关资料
  • 主要内容:实例,Compose 安装,使用,composetest/app.py 文件代码,docker-compose.yml 配置文件,yml 配置指令参考Compose 简介 Compose 是用于定义和运行多容器 Docker 应用程序的工具。通过 Compose,您可以使用 YML 文件来配置应用程序需要的所有服务。然后,使用一个命令,就可以从 YML 文件配置中创建并启动所有服务。 如果你还不了解 YML 文件配置,可以先阅读 YAML 入门教程。 Compose 使用的三个步骤:

  • 使用 Docker Compose,您可以使用一个命令启动本地测试网络。 需求 安装 tendermint 安装 docker 安装 docker-compose 构建 构建 tendermint 二进制文件和可选 tendermint/localnode docker 映像。 注意,二进制文件将被挂载到容器中,因此可以在不重新构建镜像的情况下更新它。 cd $GOPATH/src/github.

  • Docker Compose 是 Docker 官方编排(Orchestration)项目之一,负责快速的部署分布式应用。 本章将介绍 Compose 项目情况以及安装和使用。

  • 在安装 Compose之前,你需要先安装好 Docker 。然后你需要使用 curl 指令来安装 Compose 安装 Docker 首先,你需要安装大于或者等于1compose/.6版本的 Docker 。 MAC OSX 安装指南 Ubuntu 安装指南 其它系统安装指南 安装 Compose 运行下边的命令来安装 Compose: curl -L https://githubcompose/

  • 解决多容器的 APP 部署问题。 要从 Dockerfile build image 或从 Dockerhub 拉取或从 Tar export iamge。 要创建多个 container。 要管理多个 container。(启动停止删除) 介绍Docker Compose 通过一个 yml 文件定义多容器的 docker 应用,通过一条命令就可以根据 yml 文件的定义去创建或管理这些容器。 版

  • Docker Compose 是 Docker 编排服务的一部分,Machine 可以让用户在其它平台快速安装Docker,Swarm 可以让 Docker 容器在集群中高效运转,而 Compose 可以让用户在集群中部署分布式应用。简单的说,Docker Compose 属于一个“应用层”的服务,用户可以定义哪个容器组运行哪个应用,它支持动态改变应用,并在需要时扩展。 使用Compose的第一步