我们通常从docker仓库里下载了PHP,不知道什么版本的。
我们看一下库里有什么镜像
[root@localhost ~]# docker image ls
[root@localhost ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 16 months ago 141MB
php 7.4-fpm 854be5bd67a6 16 months ago 460MB
php latest 13b9b1961ba3 16 months ago 484MB
mysql latest 3218b38490ce 16 months ago 516MB
hello-world latest feb5d9fea6a5 19 months ago 13.3kB
很明显上面写的是PHP的 TAG为 latest,另一个显示的是7.4-fpm。
我们可以用下面的命令来看看,latest的最新版本是什么:
docker image inspect (docker image名称):latest|grep -i version
如果看php 那么就应该是:
[root@localhost ~]# docker image inspect php:latest|grep -i version
得到的结果如下:
[root@localhost ~]# docker image inspect php:latest|grep -i version
"PHP_VERSION=8.1.1",
"DockerVersion": "20.10.7",
"PHP_VERSION=8.1.1",
可以看到PHP的版本号为:8.1.1