I have the following command that runs when run by itself (Output: Hello):
$ docker run -it --rm --name fetch_html -v ${pwd}:/usr/src/myapp -w /usr/src/myapp php:7.4-cli php
Hello
However, I want to run it as a npm script as it's a little tedious writing the whole thing out every time:
{
...
"scripts": {
"fetch_html": "docker run -it --rm --name fetch_html -v ${pwd}:/usr/src/myapp -w /usr/src/myapp php:7.4-cli php scripts/fetch_html/cli.php"
},
...
Then:
$ npm run fetch_html
But it gives me the following error:
docker: Error response from daemon: create ${pwd}: "${pwd}" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
I've tried to change it to $(pwd) as I recall Windows and Linux having different syntax here(?). The host machine is Windows 10.
CodePudding user response:
If you are using the Windows 10 CMD interpreter, try this:
{
...
"scripts": {
"fetch_html": "docker run -it --rm --name fetch_html -v