This project provides a streamlined Docker-based development environment for Laravel using Docker. It includes setup scripts and handy Docker shortcut commands to simplify local development.
Before you begin using this project, you need to ensure that your system meets the following preinstallation requirements:
- Docker & Docker Compose installed
- Bash shell available
- Git installed
- SSH access if cloning a private repository
This project relies on Docker to create and manage containers. You need to have Docker installed on your machine.
- Docker Engine: The core component for running containers.
- Docker Compose: Used to define and run multi-container Docker applications.
You can download Docker based on your operating system:
After installation, you can verify if Docker and Docker Compose are installed correctly by running:
docker --version
docker-compose --versionNote: Docker Desktop comes with Docker Compose preinstalled, so you don’t need to install it separately on macOS and Windows. On Linux, you might need to install it manually.
This project uses Docker Compose to manage multiple Docker containers. You need to have Docker Compose installed on your machine.
You can download Docker Compose based on your operating system:
After installation, you can verify if Docker Compose is installed correctly by running:
docker-compose --version- Linux: Any supported Linux distribution (e.g., Ubuntu).
- macOS: Docker Desktop for macOS.
- Windows: Docker Desktop for Windows, with WSL 2 enabled.
- A minimum of 4 GB of RAM is recommended.
- Docker uses CPU resources to manage containers, so ensure your machine has adequate resources.
├── README.md
├── ARCHITECTURE.md
├── SCRIPTS.md
├── cmd
│ ├── art
│ ├── artisan
│ ├── bash
│ ├── clear
│ ├── composer
│ ├── container
│ ├── down
│ ├── exec
│ ├── rebuild
│ ├── restart
│ ├── stop
│ ├── up
│ ├── workspace
├── Setup
│ ├── docker
│ │ ├── docker-compose.local.yml
│ │ ├── mysql
│ │ │ └── Dockerfile
│ │ ├── nginx
│ │ │ └── sites
│ │ │ └── web.local.conf
│ │ └── workspace
│ │ └── crontab
│ │ └── laradock
│ ├── install.sh
│ ├── swagger
│ │ └── swagger.yaml
│ └── utils.sh
└── Sources
├── public
│ └── index.html
└── web/app
git clone git@github.com:mzaman/laravel-dockyard.git laravel-dockyardcd laravel-dockyardRun the setup script:
chmod +x Setup/install.sh && ./Setup/install.shsudo nano /etc/hostsAdd the following line:
127.0.0.1 web.test
This install.sh script will create a .env file with default values and set up the necessary Docker containers.
The installation script will fully automate the setup process, including the configuration of all Docker services, installation of necessary dependencies, Laravel framework setup with specific configurations, database initialization, and seeding of initial data. With this single-step operation, everything will be up and running in just a few minutes. In most cases, you won’t need to manually verify or test any of the setup steps unless there are special circumstances that require attention.
Running the install.sh script multiple times consecutively poses no issues for the proposed project. Each execution will synchronize the necessary setup steps, securely skipping any previously completed processes. It will ensure that the setup progresses from the initial scratch state through the various build stages, ultimately reaching the live application status, even if some parts of the process have already been completed.
And this is the simple installation process — setting everything up effortlessly, so you can get started in no time!
| Script | Description | Example Usage |
|---|---|---|
workspace |
Enters workspace containers | ./workspace |
up |
Starts Docker containers | ./up |
stop |
Stops Docker containers | ./stop |
down |
Stops and removes containers | ./down |
restart |
Restarts containers | ./restart |
rebuild |
Rebuilds containers with no cache | ./rebuild |
art |
Runs Laravel Artisan in container | ./art optimize:clear |
artisan |
Runs Laravel Artisan in container | ./artisan optimize:clear |
Make them executable:
chmod +x cmd/*- Enter
cmddirectory:
cd cmd-
Run
./upto start the containers. -
Run
./workspaceto enter the workspace container where software is running. -
Once inside the workspace container, enter
cd /var/www/webor simplycd webto access the Laravel application. You can now run all Composer and Artisan commands.
./art optimize:clear./composer installTo populate the database with dummy data, run the following command from the cmd directory:
./art db:seed./clearPlease see the Scripts File for more information.
Docker yaml file location: Setup/docker/docker-compose.local.yml
- Laravel code lives in:
Sources/web - Laradock lives in:
Docker/
Web URLs:
- Frontend: http://web.test
- PhpMyAdmin: http://localhost:8081
- Host:
mysql - Username:
root - Password:
root
Swagger test form: http://localhost:5555
Swagger source file location: Setup/swagger/swagger.yaml
Swagger Editor: http://localhost:5151
- Username:
laradock - Password:
laradock
MIT