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
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
-
-
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 thedocker-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 CLIbin/bash
and check the logs there. Moreover, you can copy the log folder from the container to your host usingbin/copyfromcontainer var/log
– Tu VanCommented Jul 2 at 7:18 -
-
-