1

I know changes in vendor directory should not be done but I need to do some debugging. I am using a https://github.com/markshust/docker-magento in which I am using Magento on docker. If I override any file then its working but same file I try to make any changes its not. I had added this thing in their repo too but they deleted it. May be they don't have answers or don't want to solve this problem.

1 Answer 1

3

By default, docker-magento does not support bi-directional sync for the entire project source code due to performance reasons. However, it does bi-directionally sync the folders that you work with the most, such as app/code and app/design, out of the box. All the files it syncs are listed under the config node services > app > volumes in the compose.dev.yaml file.

If you are running Linux, as it does not have performance issues with syncing the entire project source code, you can copy compose.dev-linux.yml to compose.dev.yml to enable Docker to sync the entire project source code between the host and the container. This information is already mentioned in the docker-magento repository at https://github.com/markshust/docker-magento?tab=readme-ov-file#linux.

Otherwise, whenever you modify vendor files from your host, you will need to copy them to the Docker container using the custom CLI command bin/copytocontainer.

For example:

  • Copy a file: bin/copytocontainer vendor/magento/module-cms/Controller/Index/Index.php
  • Copy a folder: bin/copytocontainer vendor/magento/module-cms
5
  • Can you also help with logs? I am unable to see logs written
    – Avesh Naik
    Commented Jul 1 at 13:58
  • You can utilize the bin/log custom CLI, which monitors the Magento log files. Pass no params to tail all files. For a specific log file, add the appropriate log filename, e.g., bin/log debug.log. I highly recommend reading the instructions from the docker-magento GitHub repo as it provides a lot of useful information. Additionally, you can drop into the bash prompt of your phpfpm Docker container by running the custom CLI bin/bash and check the logs there. Moreover, you can copy the log folder from the container to your host using bin/copyfromcontainer var/log
    – Tu Van
    Commented Jul 2 at 7:18
  • Hi thanks it really helped.
    – Avesh Naik
    Commented Jul 2 at 7:37
  • You're most welcome!
    – Tu Van
    Commented Jul 2 at 8:28
  • How should I do it permanently?
    – Avesh Naik
    Commented Sep 6 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.