We are running Magento on Kubernetes, so every time we have some more traffic new pods/containers scale up and down multiple times a day.

We are seeing some weird things happening and it seems like the generated folder should be shared across containers. We build the image used to bring the containers up, but it only contains the generated/metadata folder as we run di:compile as part of the docker image build.

We run the setup:upgrade on a separate container that we call post-deploy.

We are thinking about sharing the generated folder on EFS, is there any concern with this? Thanks.

1 Answer 1


It seems like there wouldn't have any issue sharing the generated folder across containers, but for now we have decided to NOT share the generated folder. We already run setup:di:compile when creating the docker image and that does the job to generated all files.

During our post-deploy we run setup:upgrade --keep-generated. When running --keep-generated it will maintain the generated files, but it will update the database schema.

The error we were seeing was due to permission issues with the generated folder. The group didn't have write permission to the folder, we fix the permission before running setup:di:compile and then fix it again to lock it up after the command is complete.

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.