A docker image for LEMP Stack Development
Run following commands to clone the repo, build and run LEMP Dock docker image.
git clone git@github.com:arifulhb/lempdock.git lemptdock
cd lempdock
lemp/build
lemp/run
- Build the docker image :
- Use command
lemp/buildto build the lempdock image.
- Use command
- Run the docker image:
- Use command
lemp/runto run the containers
- Use command
- Stop the container:
lemp/stopto stop the containers
- SSH to
php-fpmcontainerlemp/sshand you'll be in/var/wwwdirectory ofphp-fpmcontainer.
- Debian
9.8/ stretch OS - PHP
7.2 - Nginx
- MySQL
5.7 - Compose
1.8for PHP Package Management - Nodejs
10.15 - NPM
6.4 - git
2.11
Symlink your source code in the www directory and this source code will be available in your php-fpm and nginx containers /var/www diectory.
Do the following to symlink your PHP based app:
- cd to your www directory
- Run the following:
ln -s /path/to/project html
To add a new site in your LEMP Dock, you need to add a new nginx config file in images/nginx/sites/ directory.
Create a copy of the images/nginx/sites/default.conf file and edit server_name and root according to your application.
host: 127.0.0.1
user: root
pass: root
port: 33066
host: mysql
port: 3306
user: root
pass: root
Set up workbench to connect to local host by entering the folowing:
- Click on plus icon to add new server
- Enter mysql information above
- Once connected, click on
Data Import/Restore - In the Import Options section, click
Import from Self-Contained File - Select your file by click on the button to the far right of option choice
- Set your
Default Target Schemaby clicking on theNewbutton at the far left and entering the namexchangge - Select
Start Import
Find the container id for mysql and then run the following to access:
docker exec -it <container id> bash
After accessing, Create the database and the database user and assign the permissions
After that, Copy the database to the mysql container using the following command:
docker exec -i <container id> sh -c 'exec mysql -uroot -proot xchangge' < ./nameofdbbackup.sql