Why would PowerShell Core recognize docker commands in VS Code integrated terminal, but not in macOS Terminal?

When using PowerShell Core in VS Code’s integrated terminal, I am able to use docker commands just fine. However when trying to do the same in a regular macOS Terminal window, I get the following error:

docker : The term 'docker' 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
+ docker
+ ~~~~~~
+ CategoryInfo          : ObjectNotFound: (docker:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Would anyone know why this might be and/or how to fix this?

EDIT: It seems that, for some reason, PowerShell in a normal macOS terminal had a different directories in the PATH, despite both Terminal and VS Code are set to simply use the default shell set by chsh -s <path/to/shell>. Uninstalling and reinstalling with brew fixed the issue.

I’m still interested to know if anyone knows why this might happen.

Source: StackOverflow