How can I update the php version inside a container

Good morning friends, I need some help, how can I update the php version inside a container we have for a website.

wordpress cannot update all plugins because the php version is outdated.
.
how can i update php version inside container on ubuntu server by command line?

thank you in advance, hugs

You don’t update PHP in a container. You download a new image with a new PHP version. If you use a wordpress Docker image, you can download a new version of that. If you can’t find a new wordpress image with a new PHP version, because that wordpress is not supported anymore, then you need to build your own Docker image and recreate the container…