How to access to image out of docker

after install docker image such as php or node in docker desktop in windows 11
how to access to image to use out of environment docker
for example, open terminal CMD or Power shell and check php version but show message that php is not recognized

Question 2: Is this way right or wrong? mean better install php such as Xampp or no just install docker and access to this

PS C:\Users\syncp> php -v
php : The term ‘php’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • php -v
  •   + CategoryInfo          : ObjectNotFound: (php:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException

If the container is named as “app”, use the following command:

docker exec -it app -v

This works with official PHP containers because the arguments of the container will be appended to the “php” command which is the “entrypoint”. If it doesn’t work, then you can try the following and start the the php command:

docker exec -it app php -v

Note that you run containers (processes in isolated environments). You won’t find any of the commands on the host that the images contain. On Windows, you also have a virtual machine so when you run docker exec, you actually execute a command inside a container which is inside a virtual machine.

It depends on what you want. It is not better or worse. Xampp would work too if you need only one php version, but that is less portable.