Just ran into this. You’re probably running a docker command with sudo?
Try this: sudo -E PATH="$PATH"
By default sudo doesn’t inherit environment variables, and in particular it sets PATH to secure_path from /etc/sudoers. The -E flag tells sudo to inherit environment variables (excluding PATH) which is why we need the PATH="$PATH" too.
Hope this helps.