Can I use an external tool through Docker?
I am looking an easy way to run an external tool on my code so I fix developers issues like for example coding standards. The tool for this is called PHP-CS-Fixer. I've created a Docker image containing such tool. Now I am trying to get this running from the IDE itself since it's a little annoying been running the command once and again several times.
This image is what I have done so far to setup the tool:

This mean the tool itself is running inside the Docker container and the source exists in the host (my PC) but has been mapped thru a VOLUME inside the Docker container (basically how Docker works).
But it is not working since I got the following error:
> 11:53 AM Error running PHP-CS-Fixer: Cannot start process, the working directory 'oneview_symfony/src' does not exist
Is there any way to achieve this?
Please sign in to leave a comment.
Hi there,
Well .. I'm not a Docker user myself .. but shouldn't the "Working directory" be a FULL path and not just "something that looks like a part of the path"?
2nd possible point -- why whole command is put into the "Program" field -- shouldn't parameters go into dedicated field?
Just in case: https://confluence.jetbrains.com/display/PhpStorm/Running+External+Tools+in+PhpStorm
P.S.
This is how it can be done via File Watcher (local execution though). But you can have a look at parameters used there etc
https://stackoverflow.com/q/44073562/783119
@Andriy,
it's not working either, see below:
Error:
The error is correct: "docker exec -u www-data -it mmi_webserver_1 php_cs_fixer" is NOT a program.
The program here is "docker" (and it should be a full path to that file) -- everything else are parameters... so they should be in corresponding "Parameters" field.
We're almost there, now the problem is the "Working Directory" since this one isn't at the same route in the Docker container. Take a look at the following error:
And now take a look to my PHP interpreter configuration:
See how the working directory is being mapped inside the container, any ideas?
When you are using External Tools then you execute command/program directly (similarly to how it would be done in terminal) -- your PHP Interpreter does not participate in this, at all.
"Working directory" here is basically an another parameter that is passed to a "create process/execute task" OS system call/API that is used behind the scene -- it just tells OS what the "cwd" or "dir" (or whatever the actual correct command is that shows the current directory) should be used as "current directory".
As far as I understand:
So in the end it SHOULD look something like this (the "Parameters" field):
That worked, thank you so much I'll post this solution in my blog if you don't mind
Hi @Andriy,
I am running the latest version of the EAP but now the command does not work anymore. See pics and error below. Any ideas? Why the path is missing now? This does not happen before
This is the error:
Hi,
I'm not 100% sure .. but if your error/screenshot was not edited then the only thing I've spotted so far is $Filename$ macro have not been replaced by actual file name -- the path has still macro variable in it: /var/www/html//$Filename$
Try using the correct letter case: $FileName$ (notice capital N)
You were right the macro name has changed: before $Filename$, after: $FileName$ it worked now