Skip to content

linxiaobo/docker_lnmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Deploy lnmp(Linux, Nginx, MySQL, PHP7) using docker.

I want to share my ideas and designs about Web-Deploying using Docker with you.

Architecture

architecture

Note: The local ports may differ.

The whole app is divided into three Containers:

  1. Nginx is running in Nginx Container, which handles requests and makes responses.
  2. PHP or PHP-FPM is put in PHP-FPM Container, it retrieves php scripts from host, interprets, executes then responses to Nginx. If necessary, it will connect to MySQL as well.
  3. MySQL lies in MySQL Container,

Our app scripts are located on host, you can edit files directly without rebuilding/restarting whole images/containers.

Build and Run

At first, you should have had Docker and Docker Compose installed.

Without building images one by one, you can make use of docker-compose and simply issue:

$ docker-compose up -d

Check out your https://<docker-host> and have fun 🍺

Contributors

Based in https://github.com/micooz/docker-lnmp

License

MIT

Trouble Shooting

On Ubuntu18.04, mailcatcher might have install problem:

The solution is:

Ubuntu 18.04 changed to use systemd-resolved to generate /etc/resolv.conf. Now by default it uses a local DNS cache 127.0.0.53. That will not work inside a container, so Docker will default to Google's 8.8.8.8 DNS server, which may break for people behind a firewall.

/etc/resolv.conf is actually a symlink (ls -l /etc/resolv.conf) which points to /run/systemd/resolve/stub-resolv.conf (127.0.0.53) by default in Ubuntu 18.04.

Just change the symlink to point to /run/systemd/resolve/resolv.conf, which lists the real DNS servers:

$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Verify on the host: cat /etc/resolv.conf

Restart docker:

$ sudo service docker restart

This will solve this problem.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •