docker version LAMP (PHP + MYSQL + APACHE) Configuration

 

In recent take a test environment, start tossing back and forth between vagant and docker. In fact, both are well suited to take the development environment; but in the end I decided to use the Docker reason is because Vagant there have been some strange problems in the hyper-v, so Docker matter of course become the last option.

 

Summarized under Docker compared vagant advantages:

1. docker mirrored more mature and rich, basically just need to be introduced to get away with a vagrant, it may have to take their own, I do not want to toss to achieve a variety of installation package;

2. docker after the configuration package, and can be easily packaged with a colleague, with vagant words, colleagues may have to re-learn it again:

docker 3. Information and documents than vagant easy to find;

4. docker Jiaoshu;)

The better compatibility of hyper-v.

 

Docker-compose.yml

 

version: "3.1"

services: 
    web:
        image: php:5.6.40-apache
        ports: 
            - "80:80"
            - "443:443"
        volumes: 
            - ./app:/var/www/html
        networks:
            - default

    db:
        image: mysql:5.7
        ports: 
            - "3306:3306"
        command: --default-authentication-plugin=mysql_native_password
        environment:
            MYSQL_DATABASE: example
            MYSQL_USER: admin
            MYSQL_PASSWORD: 123456
            MYSQL_ROOT_PASSWORD: 123456
        volumes:
            - ./dump:/docker-entrypoint-initdb.d
            - ./conf:/etc/mysql/conf.d
            - ./persistent:/var/lib/mysql
        networks:
            - default

    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        links: 
            - db:db
        ports:
            - 8000:80
        environment:
            MYSQL_USER: admin
            MYSQL_PASSWORD: 123456
            MYSQL_ROOT_PASSWORD: 123456 

 

 

 

 

docker-compose profile Address: https://github.com/seozed/lamp-for-docker/tree/master

 

MYSQL

Default account: admin Default Password: 123456

Do not use this online account password!

Start command

 

docker-compose -f "docker-compose.yml" up

 

 

preview

Guess you like

Origin www.cnblogs.com/seozed/p/12457408.html