I am trying to deploy a Terra contract of the Terrain: https://www.npmjs.com/package/@terra-money/terrain
In order to deploy the counter contract I need to do the following (I am running on windows 10):
npx terrain deploy counter --signer validator
But when I do this I get the following error:
Error message: 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. See 'docker run --help'.
After searching on the internet I found out that the problem is that I am running on windows 10 and therefore need to replace $pwd by %cd%. So I went into the Terrain library to file deployment.js and found the code responsible for this error:
child_process_1.execSync(`docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer-arm64:0.12.5`, { stdio: "inherit" });
Now when I remove the second line --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
and replace $pwd with %cd%, I get the following:
child_process_1.execSync(`docker run --rm -v "%cd%":/code \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });
This seems to work as it triggered a built and a deployment. However, I removed the second line. If I add the second line back and remove $pwd with %cd%, I get the following:
child_process_1.execSync(`docker run --rm -v "%cd%":/code \
--mount type=volume,source="%(basename "%cd%")_cache%",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });
This however, doesn't work. I get the following error
docker: Error response from daemon: create %(basename C:\Users\user\Desktop\Apps\Terra\my-dapp\contracts\counter)_cache%: "%(basename C:\Users\user\Desktop\Apps\Terra\my-dapp\contracts\counter)cache%" 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.
This error looks like a similar error that I had with $pwd but now 'basename' is the problem. But I have no idea how to solve this problem. Can anyone help me out ?
I found the solution. For those in the same situation and don't know what is happening and how to solve it, I refer to this link where I posted the solution: