- Install Docker
-
Docker for Ubuntu: https://docs.docker.com/engine/installation/linux/ubuntulinux/
sudo apt-get update && apt-get install -y apt-transport-https ca-certificates sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D // Open the /etc/apt/sources.list.d/docker.list and add the following line then save it // Ubuntu 14.04 deb https://apt.dockerproject.org/repo ubuntu-trusty main // Ubuntu 16.04 deb https://apt.dockerproject.org/repo ubuntu-xenial main sudo apt-get update && apt-cache policy docker-engine && apt-get install - y linux-image-extra-$(uname -r) linux-image-extra-virtual apt-get install docker-engine sudo service docker start sudo groupadd docker sudo usermod -aG docker $USER
-
Docker for Mac: https://docs.docker.com/docker-for-mac/#/download-docker-for-mac
-
- Visit https://github.com/FramgiaDockerTeam/laravel-microservices for other information
- Clone Laravel Quick Start Project at https://github.com/laravel/quickstart-basic
git clone [email protected]:laravel/quickstart-basic.git
- Move to the project folder and creat a file named
docker-compose.yml
. Copy data from https://github.com/FramgiaDockerTeam/laravel-microservices/blob/master/docker-compose.yml into that file.
cd quickstart-basic
// You can download docker-compose.yml file using wget command
wget https://raw.githubusercontent.com/FramgiaDockerTeam/laravel-microservices/master/docker-compose.yml
- Open
.env
file and change theDB_HOST
andREDIS_HOST
...
// DB_HOST=127.0.0.1
DB_HOST=mysql
...
// REDIS_HOST=127.0.0.1
REDIS_HOST=redis
chmod
folderstorage
andbootstrap/cache
chmod -R 777 storage
chmod -R 777 bootstrap/cache
- Run docker and wait for about one minute
docker-compose up -d
// Run the following command to check docker status
docker ps
- Enter workspace container and run php commands (run only once when initialize the project)
docker exec -it project_workspace bash
composer install
php artisan migrate
- Enjoy the project at http://localhost:8000/
- To stop project, use
docker-compose down
. To start project, usedocker-compose up -d