I've been running all my dev projects via Docker to avoid the pitfalls of installing server software on my computer. This also lets me jump between macheines very easily since everything I need is wrapped up in dockerfiles, docker-compose files or package.json scripts.
WordPress development doesn't work like that. The default development environment expects PHP to be installed and will try to run PHPCS validation checks from a local instance of PHP.
The official Composer Docker image is extremely versatile. It can run arbitrary shell commands if the passed argument isn't a Composer keyword.
To run the same phpcs coding-stanards checks WordPress runs from GitHub Actions, do this:
docker run --rm -v $(pwd):/app composer /app/vendor/bin/phpcs -n --report-full