To rebuild the Docker service named php run this command
docker compose build php --no-cache
--no-cache says repull everything and build from scratch
Here is a screen shot of some of the options I use to get my container to build in WSL2 on Windows 11. Specifically the network: host option which lets the container build process pull from the internet.
# stop and remove all docker-compose.yaml containers docker compose down # start them all in daemon mode docker compose up -d