(转)Lamp on Docker

原文地址:https://linuxconfig.org/how-to-create-a-docker-based-lamp-stack-using-docker-compose-on-ubuntu-18-04-bionic-beaver-linux

学习采用 Docker + Lamp,将二者优点合而为一。

.
├── docker-compose.yml
├── php-apache
│   └── Dockerfile
├── production.yml
└── www
    └── html
            └── index.php

docker-compose.yml

version: '3'
services:
  php-apache:
    build:
      context: ./php-apache
    ports:
      - 80:80
    volumes:
      - ./www/html:/var/www/html
    links:
      - mariadb:database-service

  mariadb:
    image: mariadb:10.1
    volumes:
      - mariadb:/var/lib/mysql
    environment:
      TZ: "Asia/ShangHai"
      MYSQL_ALLOW_EMPTY_PASSWORD: "no"
      MYSQL_ROOT_PASSWORD: "rootpwd"
      MYSQL_USER: 'testuser'
      MYSQL_PASSWORD: 'testpassword'
      MYSQL_DATABASE: 'testdb'

volumes:
mariadb:

php-apache/Dockerfile

FROM php:7.2.1-apache
MAINTAINER egidio docile
RUN docker-php-ext-install pdo pdo_mysql mysqli

参考:

  1. https://linuxconfig.org/how-to-create-a-docker-based-lamp-stack-using-docker-compose-on-ubuntu-18-04-bionic-beaver-linux
  2. https://docs.docker.com/compose/production/
  3. https://linode.com/docs/applications/containers/how-to-install-docker-and-deploy-a-lamp-stack/
  4. https://stackoverflow.com/questions/39794509/how-to-open-multiple-terminals-in-docker

作者: YanWen

Web 开发者

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s