jeudi 8 août 2019

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

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire