0

I have a shell script that is attempting to start up my docker containers and then run a consul kv import command inside of them, but I am getting a no such file or directory error on the docker exec consul kv import @filepath command when I run it. Note, this did not happen before so I'm not sure what is causing the error because I made no changes to code/config between last successful run and now. Also, I'm running docker on windows.

I have tried restarting docker, ensured that the file exists and has full privileges (note: I can discover and open the file just fine in command line), and I've tried replacing the @consul-data/localhost/sbc.json with the actual file path on my computer. The command fails with the same error each time.

this is the consul service configuration in docker-compose.consul.yml:

consul:
    image: consul
    ports:
      - "8500:8500"
    volumes:
      - $CONSUL_DATA_PATH:/consul-data

Note: $CONSUL_DATA_PATH is exported in the bash script and when echoed produces the correct file location of sbc.json on my computer

this is the calling code in my bash script:

docker exec dev-env_consul_1 consul kv import @consul-data/localhost/sbc.json

Finally, the exact error is:

Error! Failed to read file: open consul-data/localhost/sbc.json: no such file or directory

The docker containers previously started without a problem, so I am unsure why this is no longer happening. Docker is up-to-date and my C drive is shared. If you have seen similar problems with consul kv, docker on windows, or anything else related to this issue please include what you know so I can investigate it in terms of this problem

tristan
  • 1
  • 2
  • additionally tried downgrading docker since I did update it once (although it still worked after the update) nonetheless, still got the same error – tristan Nov 07 '19 at 20:38
  • ok finally got it fixed! Opening Hyper-V manager on windows, force quitting docker VM and restarting it with docker desktop allowed it to load normally... unfortunately I have to do this every time I restart my machine though – tristan Nov 18 '19 at 13:52

0 Answers0