V4.5.51 docker image - PHP version incorrect?

I’m trying to spin up a docker container for v4.5.51 so that I can run the migration wizard to v5. However when I try to run

docker run --rm -it invoiceninja/invoiceninja php:4.5.51 artisan key:generate --show

I get an error saying that the PHP version is incorrect.

Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.33.

As I understand it, this is a problem with the docker image, correct? If not, I apologize, since I am new to docker.

I pulled the image from docker hub.

Hi,

@david can you please advise?

Hi, bumping this ICYMI. Any pointers would be helpful.

I think you may need to use the selfhost zip to setup a v4 install.

https://invoice-ninja.readthedocs.io/en/latest/install.html#manual-install

Looks like I’ll have to do that sadly, would have been a lot easier to use the docker image but thanks for replying!

You can also customize the Dockerfile itself, that can be found here: Docker

You would need to copy all of those lines over, and then change line 12 to PHP 7.4.33.
Line 13 should be changed to 7.4.33.

The hash on line 14 would need to be 924846abf93bc613815c55dd3f5809377813ac62a9ec4eb3778675b82a27b927.

Make sure this is in an empty folder, and run the command “docker build”, which should create the image you can then use to create a container with that uses PHP 7.4 instead.

3 Likes

Okay, this is exactly what I needed, I think I should be able to take it from here. Thank you very much!

Hi @Persnicketous and @hathidum,

Thanks for this solution. I tried this, but the file add from the first line obviously can’t be done, as this references another build stage(?). How did you manage to successfully build the new version? Or from which image did you build this?

Hey @creyD. IIRC it didn’t work for me either. I ended up spinning up a local web server on a linux machine, installing v4 on it and running the migrate script. I may even have used an era-appropriate linux liveimage, although I’m not so sure now.

1 Like

Thanks for your input and quick reply! I wanted to dockerize an existing 4.5 installation, but as the docker image doesn’t work I will advise internally that we switch to 5.0 to avoid the failing docker build.