Aaditya Goenka
Aaditya Goenka

Reputation: 23

I am unable to upgrade my PHP version in my docker wordpress installation

I am trying to move my existing multisite network to the Docker/Kubernetes setup for easy backup and management. I have an environment setup at

MYSQL : 5.7.2

PHPMYADMIN: Latest

WordPress: 5.6 (the PHP version in this installation is 7.3 which I need to update) I want to upgrade to PHP 8.0.0

I was suggested to use a docker file which I did, --> https://github.com/docker-library/wordpress/blob/5bbbfa8909232af10ea3fea8b80302a6041a2d04/latest/php8.0/apache/Dockerfile When running this with a correction in line 149 :

    RUN ["chmod", "+x", "docker-entrypoint.sh"]
    ENTRYPOINT ["./docker-entrypoint.sh"]
    CMD ["apache2-foreground"]

I get the following error,

ERROR: for wordpress Cannot start service wordpress: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown ERROR: Encountered errors while bringing up the project. PS C:\Users\dev> docker-compose up -d dev_db_1 is up-to-date Starting dev_wordpress_1 ... Starting dev_wordpress_1 ... error

ERROR: for dev_wordpress_1 Cannot start service wordpress: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown
ERROR: for wordpress Cannot start service wordpress: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown ERROR: Encountered errors while bringing up the project.

I need your help in getting my WordPress image running, I am unsure about what does this, (docker-entrypoint.sh) contain, or where to place it.

Your help and guidance is well appreciated in advance.

Regards, Aaditya

Upvotes: 0

Views: 2497

Answers (2)

queeg
queeg

Reputation: 9384

Actually you should not try to update php inside a docker container. Instead find out how the container is built, then build one that contains the php version you desire. This will keep the image simple and small.

Upvotes: 1

Davide Madrisan
Davide Madrisan

Reputation: 2300

You can find the script docker-entrypoint.sh at https://github.com/docker-library/wordpress/tree/5bbbfa8909232af10ea3fea8b80302a6041a2d04/latest/php8.0/apache, the same folder where you get the Dockerfile.

docker-entrypoint.sh is the script that is executed once the Docker image is loaded (so as the name says it's the image entry-point).

I'm able to build and load the Wordpress image with PHP 8.0 and Apache with the following commands:

git clone https://github.com/docker-library/wordpress.git
cd wordpress/latest/php8.0/apache
podman build -t wordpress_php8 .
podman run --rm -it -p 8000:80 localhost/wordpress_php8:latest

Now I'm able to connect to the site http://127.0.0.1:8000/

enter image description here

No need of any correction.

Note that you can use docker instead of podman, if you prefer.

Works also with this simple docker-compose file:

version: "3.9"
services:
  wordpress:
    build:
      context: "./"
      dockerfile: Dockerfile
    ports:
      - "8000:80"

sudo docker-compose up.

Upvotes: 0

Related Questions