Because the installation process involves some steps to modify the configuration file , Because I just tried, I'm not very good at , So it's all done after installation , Enter the container to modify the configuration , Finally, exit and restart the container .

Directory structure

├── mysql
│   └── dockerfile
├── nginx  
│   └── dockerfile
└── php7
└── dockerfile

Generate... Separately 3 A mirror image

sudo docker build -t lemon/mysql  .

sudo docker build -t lemon/php    .

sudo docker build -t lemon/nginx  .

Building three containers

Need to pay attention to 2 A key point

1. Want to use link Command to connect containers

2. Through data volume send php-fpm and nginx The working directory of points to the same directory

# Set up root password 123456
sudo docker run --name mysql -d -p : -v $HOME/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD= lemon/mysql

# The following key commands --link
#--link Connect mysql
sudo docker run --name php -d -p : -v $HOME/web:/usr/local/nginx/html --link mysql:mysql lemon/php

#--link Connect php
sudo docker run --name nginx -d -p : -v $HOME/web:/usr/local/nginx/html --link php:php lemon/nginx

Get into nginx Containers

sudo docker exec -it nginx bash

modify conf file

location ~ \.php$ {
root html;
# The key - php Container of 9000 port
fastcgi_pass php:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

Get into php Containers

sudo docker exec -it php bash

Revision respectively www.conf

# To monitor all 9000 port 
listen =
Change it to
listen = [::]:

modify php.ini

# increase swoole
extension = # increase opcache To configure
[Zend Opcache]

Exit the container , Just restart

sudo docker restart nginx
sudo docker restart php

stay $HOME/web New under directory php file , adopt Can successfully access .

dockerfile file :

docker build lnmp( One ) More articles about

  1. Mac Next docker build lnmp Environmental Science + redis + elasticsearch

    Before that windows I've been using vagrant Do development , There are also various development environments in the team , A few people don't have a unified environment , All kinds of online are human flesh , Occasionally, because of the development . test . Problems caused by inconsistent software versions or configurations in the production environment , This year will be ...

  2. docker build lnmp Environmental Science ( problem , Information , command )

    Introduction reference Ten common commands to play with docker 1. # Pull a mirror image from the official website docker pull & ...

  3. Use docker build lnmp Environmental Science

    Docker Containers LNMP Environment building install Making mirrors Start and associate instances install System environment Hardware type : ThinkPad T520 System version : ubuntu 14.04 CPU: i7 RAM: 8G add software ...

  4. Docker Introduction and use docker build lnmp The process of ( many PHP edition )

    One .Docker Basics Docker install Docker requirement Ubuntu The kernel version of the system is higher than 3.10 , Check the prerequisites on this page to verify yours Ubuntu Does the version support Docker. adopt uname ...

  5. docker build lnmp Environmental Science

    1. build lnmp Website platform 1. establish mysql Database container docker run -it -d --name lnmp_mysql -p 3308:3306 -e MYSQL_ROOT_PASSWORD= ...

  6. use Docker build LNMP

    A word that programmers often say : It's normal on my machine , There must be something wrong with your machine . therefore ,Docker The birth of , It packs everything the app needs , So it's easy to deploy . Docker Main purpose of , At present, there are three categories : Provide ...

  7. Docker Introduction details —— install docker And make use of docker build lnmp

    First we need to install docker Environmental Science , This is simpler , With centos7 For example docker stay centos7 The kernel version of the system is required to install on 3.10+, Can pass uname -r Check the kernel version number , If the version does not match, please refer to the information ...

  8. Docker build LNMP Website platform

    1. Custom network [root@linux-docker01 ~]# docker network create lnmp 67e7e0736b2c58f8f81eed50130803b34be0583f ...

  9. Use Docker build LNMP development environment

    1. What is? Docker Docker Use Google company-launched Go Language Development implementation , be based on Linux Kernel cgroup,namespace, as well as AUFS Class Union FS Equal skill ...

  10. be based on Docker build LNMP Environmental Science ( turn )

    About what is docker, I suggest you check the usage on the Internet first . If you don't understand , In this article , You can simply understand it as a lightweight virtual machine . One .docker install mysql First , We pulled one from the warehouse MySql Mirror image ...

Random recommendation

  1. POJ 1811 Prime Test (Pollard rho Big integer factorization )

    The question : Give a N, if N As a prime number , Output Prime. If it's a composite number , Output the smallest prime factor . Ideas :Pollard rho Big integer factorization , The template questions #include <iostream> #include < ...

  2. Two 、UITableView And its relatives

    . UITableView Reference resources : ...

  3. be based on KVM The steps and summary of establishing virtual machine

    1. Preface Now we're in Cloud Computing IaaS Work , Virtualization is IaaS Important part of , Therefore, during this period of time, research on various virtualization technologies and tools , The purpose of the study is not just to be able to use the tool , But through research to understand the implementation mechanism and principle of Technology , That is to say ...

  4. Use DapperSimpleCRUD Yes Repository Layer for encapsulation

    Use... Through the previous two articles Dapper operation Mysql Database and usage Dapper Parameterized query , About Dapper Some basic operation and simple use of , In actual use , We can simply divide projects into MVC+Service ...

  5. How to weave clouds Lite Have a good time TSW

    Welcome to Tencent cloud + Community , Get more Tencent mass technology practice dry goods ~ Weaving clouds Lite & TSW Weaving clouds Lite It is a lightweight service management platform , Provide standardized application packaging operation , Connectable continuous integration system , Complete online program distribution ...

  6. Sync Name To Comment And Sync Comment To Name

    stay  PowerDesigner Carry out orders   Tools->Execute Commands->Edit/Run Scripts Code 1 : take Name The characters in COPY to Comment in Opti ...

  7. RN Screenshots and download questions

    magical BUG A lot of . demand --> Take a screenshot and download the picture Realization : import ViewShot from "react-native-view-shot"; CameraRoll ...

  8. Algorithm -----python Realization

    Fibonacci sequence def f(n): if n == 1: return 1 elif n == 2: return 1 else: return f(n-1)+f(n-2) print(f(8)) Use pu ...

  9. [ translate ]Bitmap Asynchronous loading and caching of

    Description of content [ translate ] Developing documents :android Bitmap Efficient use of The content of this article comes from the development documentation "Traning > Displaying Bitmaps Efficiently", ...

  10. Postman simulation Request Payload Send a request

    Postman simulation Request Payload Send a request , As shown in the figure below :