php - Docker-compose volume changed update slowly (how to fix)

76

I build a small Laravel website using docker-compose.

Now when I change anything using my editor on the host file system (KUbuntu), it takes a long time (varying from 0s to more than a minute) before changes in the code reflect in the website.

My docker-compose.yml looks like this:

version: '2'

services:
  mariadb:
    image: 'bitnami/mariadb:10.1'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=my_user
      - MARIADB_DATABASE=my_database
      - MARIADB_PASSWORD=my_password
    ports:
      - 9990:3306
    volumes:
      - /home/haaiee/Projects/Docker/decode_appdata/database/mariadb_data:/bitnami/mariadb
  myapp:
    tty: true
    image: bitnami/laravel:5-debian-9
    environment:
      - DB_HOST=mariadb
      - DB_USERNAME=my_user
      - DB_DATABASE=my_database
      - DB_PASSWORD=my_password
    depends_on:
      - mariadb
    ports:
      - 3000:3000
    volumes:
      - ./:/app

And in my website when I change

echo 'A'; die();

to

echo 'B'; die();

when I refresh the webpage (firefox, crtl-F5), it still shows "A".
Only after some time it changes to "B".

Sometimes changes seem to work instantaneously, other times, it can take minutes.

Is there any way to fix this slowness?

People are also looking for solutions to the problem: php - instatiating an object whose class does not have an __construct method

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.