When attempting to add images programmatically to a Magento cloud instance we are getting the following error:

Warning: mkdir(): Read-only file system

We did find the following post, but the reply says we need to checkout the instance using GIT, copy the files locally and then redeploy. There must be a better way?

Upload optimized images to magento cloud server

1 Answer 1


The media directory is not read-only. If you are having problems check your .magento.app.yaml file and ensure the following section is present:

    "var": "shared:files/var"
    "app/etc": "shared:files/etc"
    "pub/media": "shared:files/media"
    "pub/static": "shared:files/static"

I would also check where the Warning: mkdir(): Read-only file system error is coming from and check its not trying to create a directory where it shouldn't.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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