I'm new at Docker but I want to use it in order to make easier to organize my production environment. I need an environment with NGINX, PHP 7.2 and Node (and some others); after some digging I used docker-compose:
version: '0.2'
restart: always
services:
web:
image: nginx:latest
container_name: NGINX
ports:
- "80:80"
volumes:
- ./code:/code
- ./nginx/conf.d/site.conf:/etc/nginx/conf.d/site.conf
- ./nginx/sites-enabled:/etc/nginx/sites-enabled
links:
- php
php:
build: ./php
container_name: PHP7.2
volumes:
- ./code:/code
composer:
image: composer:latest
container_name: Composer
volumes:
- ./code:/code
node:
build: ./node
container_name: Node
volumes:
- ./code:/code
When I run sudo docker-compose up
everything works, however since I'm using a Laravel (5.5) application I have some artisan commands. Some commands scan all application files to populate the database and this process is extremely slow (+10x slower) when comparing to my local environment (Vagrant).
I've researched and apparently volumes have some performance issues; I've tried docker-sync but nothing changed. I really want to make this work but I can't figure out what is going on.
time
command) that show the commands you are running natively under Vagrant and then under Docker for comparison. If you are comparing to Vagrant it would also be helpful to know the Vagrant configuration (Vagrantfile
and any other Vagrant specific commands you run). But generally speaking, volume performance for Docker on Mac and Docker on Windows is pretty abysmal compared to Linux native.