docker-compose - No such service via Vagrant-Windows shells only

大城市里の小女人 提交于 2019-12-11 13:39:16

问题


I am running into an issue with Vagrant/Docker-Compose that seems to be specific to Windows. Here's an overview of the setup and orchestration:

  • Vagrant using a boot2docker box
  • Several docker containers running inside of boot2docker VM
  • Vagrantfile that runs several shell scripts
  • Inside of those shell scripts, I run commands that call out from the boot2docker VM to it's child Docker containers. An example of those commands look like: docker exec -i $(docker-compose ps -q $DOCKER_DBSVC) /bin/bash /db/dockersetup/restoreMyDB.sh
  • Running vagrant up on my Linux Mint box (and an Ubuntu box) yield working machines that execute all commands properly
  • Running vagrant up on Windows fails on the above command (and commands like it) with a No such service: my-db-service
  • I have run docker-compose config --services after upping the containers and can verify that the service names exist, but for whatever reason the command fails on Windows hosts only!
  • After the scripts fail, the machine still boots up and the Docker containers are alive. I can then vagrant ssh into the box (via Windows host), and reference the containers by service name!

Any suggestions?


回答1:


Line endings, line endings, line endings. The Windows repos were checking out and converting LF to CRLF, so the service names had that goofy CR sitting at the end of them... To fix this, I created the following script based on this answer:

#!/bin/bash
git config --global core.autocrlf false
git config --global core.eol lf
git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f


来源:https://stackoverflow.com/questions/37260593/docker-compose-no-such-service-via-vagrant-windows-shells-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!