Docker Community Forums

Share and learn in the Docker community.

Magento framework is upgraded during container build but again asking for upgrade while container is up

I am facing a strange issue. I want to build a docker image with an existing Magento project. To make that application running I had to run following command

php -dmemory_limit=2G bin/magento setup:upgrade && php -dmemory_limit=2G bin/magento setup:di:compile && ph	p -dmemory_limit=2G bin/magento setup:static-content:deploy -f && php -dmemory_limit=2G bin/magento indexer:reindex && php -dmemory_limit=2G bin/magento cache:flush

Which is working fine when I perform that step inside a container manually and the site is up and running properly. But when I put this step inside Dockerfile and build the image, it goes well and good. Now when I launch the container it following message

The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration.

Then I run the above command again inside the container and it works fine.
Why is it so I want to perform the step during the build so that once I spin up the container the site should work as expected.

As you write it correctly, this command is run at the moment when you build the image. It should probably run after the container is started, so its place would be in an entrypoint script.