I'm having issues setting the CRYPT_KEY environment variable in production mode. I can see CRYPT_KEY and env:CRYPT_KEY using the magento-cloud variable:list command, but it isn't recognized when I run docker commands. Inside bin/magento-docker bash, if I run vendor/bin/ece-tools env:config:show, I see the admin email and password that are used to login to the docker container. It looks like ece-tools inside magento-docker bash show the environment variables that are used, and the environment variables from magento-cloud variables:list aren't copied to docker. Would someone be able to explain the difference between these two commands, and how to set CRYPT_KEY inside magento-docker?

1 Answer 1


I got some help from Joe Shelton, wagento-joe, on the magento Slack, #cloud-docker channel.

The magento-cloud CLI manages Cloud environments. It won't interact with a local environment or docker environment.

The crypt key can be set manually in the env.php file, but it seems that the file was overwritten in one of the build steps.

To set environment variables locally, use docker-compose.override.yml or .docker/config.env. I used .docker/config.env. MAGENTO_CLOUD_VARIABLES inside .docker/config.env is a base64 encoded json string.

To set a new crypt key:

  1. In the Magento instance admin, go to System > Other Settings > Manage Encryption Key
  2. Generate a new key and save it for later
  3. Decode MAGENTO_CLOUD_VARIABLES in .docker/config.env to get the existing cloud variables
  4. Add the crypt key with CRYPT_KEY as the JSON key
  5. Encode the JSON and replace the existing MAGENTO_CLOUD_VARIABLES with the encoded JSON string

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.