专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

热门搜索:openclaw🔥nginx🔥redis🔥mysqlopenjdkcursorweb2apimemgraphzabbixetcdubuntucorednsjdk
lamp

mattrayner/lamp

自动构建
mattrayner

Docker-LAMP是一套基于Phusion基础镜像的Docker镜像,包含Apache、MySQL和PHP组成的LAMP栈,支持Ubuntu 14.04、16.04和18.04版本,提供一站式LAMP开发环境,适用于各类PHP应用开发与部署,具备多版本灵活性和简便的使用流程。

363 次收藏下载次数: 0状态:自动构建维护者:mattrayner仓库类型:镜像最近更新:2 年前
轩辕镜像,让镜像更快,让人生更轻。点击查看
版本下载
轩辕镜像,让镜像更快,让人生更轻。点击查看

Docker-LAMP is a set of docker images that include the phusion baseimage (14.04, 16.04 and 18.04 varieties), along with a LAMP stack (Apache, MySQL and PHP) all in one handy package.

With Ubuntu 18.04 amd 16.04 images on the latest-1804 and latest-1604 tags, Docker-LAMP is flexible enough to use with all of your LAMP projects.

https://hub.docker.com/r/mattrayner/lamp

Contents

  • Introduction
  • Image Versions
  • Using the image
    • On the command line
    • With a Dockerfile
    • MySQL Databases
      • Creating a database
        • PHPMyAdmin
        • Command Line
  • Adding your own content
    • Adding your app
    • Persisting your MySQL
    • Doing both
      • .bash_profile alias examples
        • Example usage
  • Developing the image
    • Building and running
    • Testing
    • One-line testing command
      • docker-compose -f docker-compose.test.yml -p ci build;
      • docker-compose -f docker-compose.test.yml -p ci up -d;
      • docker logs -f ci_sut_1;
      • echo "Exited with status code: $(docker wait ci_sut_1)"
  • Inspiration
  • Contributing
  • License

Introduction

As a developer, part of my day to day role is to build LAMP applications. I searched in vein for an image that had everything I wanted, up-to-date packages, a simple interface, good documentation and active support.

To complicate things even further I needed an image, or actually two, that would run my applications on both 14.04 and 16.04. Having two entirely separate workflows didn't make any sense to me, and Docker-LAMP was born.

Designed to be a single interface that just 'gets out of your way', and works on 14.04 and 16.04 with php 5 and 7. You can move between all 4 images without changing how you work with Docker.

Image Versions

NOTE: PHP 5.6 is end of life, so the PHP 5 images mattrayner/lamp:latest-1404-php5 and mattrayner/lamp:latest-1604-php5 will not receive any updates. Although these images will stay on Docker Hub, we strongly recommend updating you applications to PHP7.

NOTE: The 14.04 variant of this image is no longer being actively supported for updated

There are 4 main 'versions' of the docker image. The table below shows the different tags you can use, along with the PHP, MySQL and Apache versions that come with it.

Componentlatest-1404latest-1604latest-1804
Apache2.4.72.4.182.4.29
MySQL5.5.625.7.265.7.26
PHP7.3.37.3.67.3.6
phpMyAdmin4.8.54.9.0.14.9.0.1

Using the image

On the command line

This is the quickest way

bash
# Launch a 18.04 based image
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1804

# Launch a 16.04 based image
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1604

# Launch a 14.04 based image
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1404

With a Dockerfile

docker
FROM mattrayner/lamp:latest-1804

# Your custom commands

CMD ["/run.sh"]

MySQL Databases

By default, the image comes with a root MySQL account that has no password. This account is only available locally, i.e. within your application. It is not available from outside your docker image or through phpMyAdmin.

When you first run the image you'll see a message showing your admin user's password. This user can be used locally and externally, either by connecting to your MySQL port (default 3306) and using a tool like MySQL Workbench or Sequel Pro, or through phpMyAdmin.

If you need this login later, you can run docker logs CONTAINER_ID and you should see it at the top of the log.

Creating a database

So your application needs a database - you have two options...

  1. PHPMyAdmin
  2. Command line

PHPMyAdmin

Docker-LAMP comes pre-installed with phpMyAdmin available from http://DOCKER_ADDRESS/phpmyadmin.

NOTE: you cannot use the root user with PHPMyAdmin. We recommend logging in with the admin user mentioned in the introduction to this section.

Command Line

First, get the ID of your running container with docker ps, then run the below command replacing CONTAINER_ID and DATABASE_NAME with your required values:

bash
docker exec CONTAINER_ID  mysql -uroot -e "create database DATABASE_NAME"

Adding your own content

The 'easiest' way to add your own content to the lamp image is using Docker volumes. This will effectively 'sync' a particular folder on your machine with that on the docker container.

The below examples assume the following project layout and that you are running the commands from the 'project root'.

/ (project root)
/app/ (your PHP files live here)
/mysql/ (docker will create this and store your MySQL data here)

In english, your project should contain a folder called app containing all of your app's code. That's pretty much it.

Adding your app

The below command will run the docker image mattrayner/lamp:latest interactively, exposing port 80 on the host machine with port 80 on the docker container. It will then create a volume linking the app/ directory within your project to the /app directory on the container. This is where Apache is expecting your PHP to live.

bash
docker run -i -t -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest

Persisting your MySQL

The below command will run the docker image mattrayner/lamp:latest, creating a mysql/ folder within your project. This folder will be linked to /var/lib/mysql where all of the MySQL files from container lives. You will now be able to stop/start the container and keep your database changes.

You may also add -p 3306:3306 after -p 80:80 to expose the mysql sockets on your host machine. This will allow you to connect an external application such as SequelPro or MySQL Workbench.

bash
docker run -i -t -p "80:80" -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest

Doing both

The below command is our 'recommended' solution. It both adds your own PHP and persists database files. We have created a more advanced alias in our .bash_profile files to enable the short commands ldi and launchdocker. See the next section for an example.

bash
docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest

.bash_profile alias examples

The below example can be added to your ~/.bash_profile file to add the alias commands ldi and launchdocker. By default it will launch the 16.04 image - if you need the 14.04 image, simply change the docker run command to use mattrayner/lamp:latest-1404 instead of mattrayner/lamp:latest.

bash
# A helper function to launch docker container using mattrayner/lamp with overrideable parameters
#
# $1 - Apache Port (optional)
# $2 - MySQL Port (optional - no value will cause MySQL not to be mapped)
function launchdockerwithparams {
    APACHE_PORT=80
    MYSQL_PORT_COMMAND=""
    
    if ! [[ -z "$1" ]]; then
        APACHE_PORT=$1
    fi
    
    if ! [[ -z "$2" ]]; then
        MYSQL_PORT_COMMAND="-p \"$2:3306\""
    fi

    docker run -i -t -p "$APACHE_PORT:80" $MYSQL_PORT_COMMAND -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest
}
alias launchdocker='launchdockerwithparams $1 $2'
alias ldi='launchdockerwithparams $1 $2'

Example usage

bash
# Launch docker and map port 80 for apache
ldi

# Launch docker and map port 8080 for apache
ldi 8080

# Launch docker and map port 3000 for apache along with 3306 for MySQL
ldi 3000 3306

Developing the image

Building and running

bash
# Clone the project from Github
git clone https://github.com/mattrayner/docker-lamp.git
cd docker-lamp

# Build the 18.04, 16.04 image and the 14.04 images
docker build -t=mattrayner/lamp:latest -f ./1804/Dockerfile-php7 .
docker build -t=mattrayner/lamp:latest-1604 -f ./1604/Dockerfile-php7 .
docker build -t=mattrayner/lamp:latest-1404 -f ./1404/Dockerfile-php7 .

# Run the 14.04 image as a container
docker run -p "3000:80" mattrayner/lamp:latest-1404 -d

# Sleep to allow the container to boot
sleep 5

# Curl out the contents of our new container
curl "http://$(docker-machine ip):3000/"

Testing

We use docker-compose to setup, build and run our testing environment. It allows us to offload a large amount of the testing overhead to Docker, and to ensure that we always test our image in a consistent way thats not affected by the host machine.

One-line testing command

We've developed a single-line test command you can run on your machine within the docker-lamp directory. This will test any changes that may have been made, as well as comparing installed versions of Apache, MySQL, PHP and phpMyAdmin against those expected.

bash
docker-compose -f docker-compose.test.yml -p ci build; docker-compose -f docker-compose.test.yml -p ci up -d; docker logs -f ci_sut_1; echo "Exited with status code: $(docker wait ci_sut_1)";

So what does this command do?

docker-compose -f docker-compose.test.yml -p ci build;

First, build that latest version of our docker-compose images.

docker-compose -f docker-compose.test.yml -p ci up -d;

Launch our docker containers (web1804, web1604, web1404 and sut or system under tests) in daemon mode.

docker logs -f ci_sut_1;

Display all of the logging output from the sut container (extremely useful for debugging)

echo "Exited with status code: $(docker wait ci_sut_1)"

Report back the status code that the sut container ended with.

Inspiration

This image was originally based on https://github.com/dgraziotin/osx-docker-lamp, with a few changes to make it compatible with the Concrete5 CMS.

I also changed the setup to create ubuntu (well, baseimage, but you get what I'm saying) images so that this project could be as useful as possible to as many people as possible.

Contributing

If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.

  1. Clone/fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Test your changes using the steps in Testing
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

License

Docker-LAMP is licensed under the Apache 2.0 License.

Deployment & Usage Documentation

LAMP Docker 容器化部署指南

LAMP是一种成熟的开源Web应用程序架构,由Linux操作系统、Apache网页服务器、MySQL数据库和PHP编程语言组成。通过Docker容器化部署LAMP架构,可以显著简化环境配置流程,确保开发、测试和生产环境的一致性,同时提高部署效率和系统可维护性。

Read More

查看更多 lamp 相关镜像 →

flattrack/flattrack logo

flattrack/flattrack

flattrack
FlatTrack是一款免费开源的网络服务,旨在促进公寓和家庭中的协作,帮助管理购物清单、任务等日常事务。
1万+ 次下载
23 天前更新
stagex/core-attr logo

stagex/core-attr

stagex
暂无描述
730 次下载
28 天前更新
attraccess/attraccess logo

attraccess/attraccess

attraccess
暂无描述
1万+ 次下载
1 个月前更新

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

Docker 配置

登录仓库拉取

通过 Docker 登录认证访问私有仓库

专属域名拉取

无需登录使用专属域名

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

Harbor 镜像源配置

Harbor Proxy Repository 对接专属域名

Portainer 镜像源配置

Portainer Registries 加速拉取

Nexus 镜像源配置

Nexus3 Docker Proxy 内网缓存

系统配置

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

MacOS OrbStack

MacOS OrbStack 容器配置

Docker Compose

Docker Compose 项目配置

NAS 设备

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

极空间

极空间 NAS 系统配置服务

网络设备

爱快路由

爱快 iKuai 路由系统配置

宝塔面板

在宝塔面板一键配置镜像

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

使用与功能问题

配置了专属域名后,docker search 为什么会报错?

docker search 限制

Docker Hub 上有的镜像,为什么在轩辕镜像网站搜不到?

站内搜不到镜像

机器不能直连外网时,怎么用 docker save / load 迁镜像?

离线 save/load

docker pull 拉插件报错(plugin v1+json)怎么办?

插件要用 plugin install

WSL 里 Docker 拉镜像特别慢,怎么排查和优化?

WSL 拉取慢

轩辕镜像安全吗?如何用 digest 校验镜像没被篡改?

安全与 digest

第一次用轩辕镜像拉 Docker 镜像,要怎么登录和配置?

新手拉取配置

错误码与失败问题

docker pull 提示 manifest unknown 怎么办?

manifest unknown

docker pull 提示 no matching manifest 怎么办?

no matching manifest(架构)

镜像已拉取完成,却提示 invalid tar header 或 failed to register layer 怎么办?

invalid tar header(解压)

Docker pull 时 HTTPS / TLS 证书验证失败怎么办?

TLS 证书失败

Docker pull 时 DNS 解析超时或连不上仓库怎么办?

DNS 超时

Docker 拉取出现 410 Gone 怎么办?

410 Gone 排查

出现 402 或「流量用尽」提示怎么办?

402 与流量用尽

Docker 拉取提示 UNAUTHORIZED(401)怎么办?

401 认证失败

遇到 429 Too Many Requests(请求太频繁)怎么办?

429 限流

docker login 提示 Cannot autolaunch D-Bus,还算登录成功吗?

D-Bus 凭证提示

为什么会出现「单层超过 20GB」或 413,无法加速拉取?

413 与超大单层

账号 / 计费 / 权限

轩辕镜像免费版和专业版有什么区别?

免费版与专业版区别

轩辕镜像支持哪些 Docker 镜像仓库?

支持的镜像仓库

镜像拉取失败还会不会扣流量?

失败是否计费

麒麟 V10 / 统信 UOS 提示 KYSEC 权限不够怎么办?

KYSEC 拦截脚本

如何在轩辕镜像申请开具发票?

申请开票

怎么修改轩辕镜像的网站登录和仓库登录密码?

修改登录密码

如何注销轩辕镜像账户?要注意什么?

注销账户

配置与原理类

写了 registry-mirrors,为什么还是走官方或仍然报错?

mirrors 不生效

怎么用 docker tag 去掉镜像名里的轩辕域名前缀?

去掉域名前缀

如何拉取指定 CPU 架构的镜像(如 ARM64、AMD64)?

指定架构拉取

用轩辕镜像拉镜像时快时慢,常见原因有哪些?

拉取速度原因

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
mattrayner/lamp
博客公告Docker 镜像公告与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
镜像拉取问题咨询请 提交工单,官方技术交流群:1072982923。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
镜像拉取问题咨询请提交工单,官方技术交流群:。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
商务合作:点击复制邮箱
©2024-2026 源码跳动
商务合作:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.