Configure CodeSniffer on PhpStorm using Docker

I am developing a project using PhpStorm and I am using Php 7.1 with Docker. I would like to integrate PHP code sniffer in PhpStorm.

In PhpStorm I go to Settings|Languages&Frameworks|PHP|CodeSniffer and I try to add a new configuration, I provide as PHP Code Sniffer (phpcs) path the path of a script with the following content:

  • Monitor docker containers based on labels assigned
  • docker-compose up vs docker-compose up --build vs docker-compose build --no-cache
  • Docker default CPU architecture doesn't match host's
  • Pushing a tag to private docker registry in artifactory fails from mac
  • Can docker services only be attached to docker overlay networks?
  • Supervisor & Docker: How to exit Supervisor if a service doesn't start?
  • #!/usr/bin/env bash
    docker run --rm -ti --volume "$(pwd):/app:rw" -u $(id -u):$(id -g) prooph/php:7.1-cli php vendor/bin/phpcs "$@"

    which just runs phpcs in my docker container.

    When I click on Validate, PhpStorm gives me the following message:

    The input device is not a TTY

    The same script works perfectly when it’s run from PhpStorm console.

    Am I doing something wrong? Or what I am trying to do is just not supported?

  • Write logs in PHP outside Docker container
  • Wifi stopped working after docker installation on Linux
  • Docker error in Linux mint 17
  • Windows 7 - Error: connect ENOENT //./pipe/docker_engine
  • What is Docker storage driver
  • Running Docker in Memory?
  • One Solution collect form web for “Configure CodeSniffer on PhpStorm using Docker”

    You should run it without -t flag:

    #!/usr/bin/env bash
    docker run --rm -i --volume "$(pwd):/app:rw" -u $(id -u):$(id -g) prooph/php:7.1-cli php vendor/bin/phpcs "$@"

    -t allocates a pseudo-TTY, that’s why it works on PhpStorm console.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.