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:

  • docker exec command not executing in sh file
  • Starting a container only after the previous container is Running
  • http response got truncated in docker
  • docker Error response from daemon: json: cannot unmarshal object into Go value of type []string
  • Running Flask app in a Docker container
  • Kubernetes Kubelet doesn't have access to Docker
  • #!/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?

  • Docker error: exit status 255
  • ceph rbd with docker volumes
  • postgres $HOME directory unproperly set in Docker container created from official postgres Dockerfile
  • terminal list the files but not visible in file browser - NFS
  • Change directory in docker alpine failing
  • Where execute RUN command from Dockerfile, Host or Intermediate container?
  • 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.