Php version doesn't change even it was changed in Dockerfile

Hi everyone.

I want to dockerize a web app and i created a dockerfile based on php-apache 8.0.
I had some problems with some extensions, so i decided to change the php version to 7.4.
But after executed docker-compose down and docker compose up, the php version didn’t change.

I’m relatively new on docker so i doesn’t not understand all the concepts around it yet.

I’m on windows 10 pro, runing docker desktop 4.10.1

Sorry for my english.

Thaks in advance.

Please, share how you have changed the version and how you ran commands (in which order). If you really deleted the containers and changed the image tag, compose up can’t run the previous image. Actually you don’t even need to run down before up. COmpose will download the new image, delete the previous container and start a new container. Make sure you change the image tag and not an other parameter like the PHP version in a composer.json file.

I ran docker-compose down, after that in the Dockerfile i changed the line FROM php:8.0-apache to FROM php:7.4-apache. I ran docker-compose up -d and checked the version using a phpinfo script.
But the version is istill 8.0.22

I see. I thought you have changed it in the compose file. I missed that you mentioned “Dockefile” in the topic title. When you first run docker-compose up, compose will build the image. After that it will not rebuild it whenever you change something in it, only if you use the --build option.

docker-compose up --build
2 Likes

Ok, i will check that.