The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

409259 (6) [Avatar] Offline
#1
Hi,

Can the examples in the book be run on docker toolbox for windows?

Currently when I try to run the steps listed in the repo I get the error below:

$ docker-compose -f common/docker-compose.yml up
Creating common_licensingservice_1
Attaching to common_licensingservice_1
licensingservice_1 | /bin/sh: ./run.sh: not found
common_licensingservice_1 exited with code 127
John C Carnell (44) [Avatar] Offline
#2
Hi,

Your code should work with Docker for windows. The error you are getting almost seems to indicate that when the licensing docker container is started it cant fine the run.sh. I am running Docker native on the Mac. Unfortunately, I do not have a windows box to test the code on. (I have run in linux and OS X).

Thanks,
John
dschulten (8) [Avatar] Offline
#3
I have the exact same problem. Indeed, sh does not see run.sh, although it is there in the filesystem. The container is fine and sh finds executables on PATH and manually added executables, but not run.sh.


I have opened a stackoverflow question http://stackoverflow.com/questions/43556722/sh-in-docker-image-does-not-see-executable
dschulten (8) [Avatar] Offline
#4
OK the reason is, run.sh is created with Windows line endings in the docker image if you check out with automatic lf->crlf conversion. One possible solution is to tell git not to convert line endings for *.sh files.

When cloning, do not checkout immediately (Tortoise: enable 'No Checkout' option)
Add a.gitattributes file with the following content to your empty, cloned working directory:

*.sh text eol=lf


Afterwards, check out (Tortoise: Switch/Checkout master)

Request for improvement: add .gitattribute file to the book's source repository. Should I send a PR for that?
kkelleher (19) [Avatar] Offline
#5


409259 wrote:Hi,

Can the examples in the book be run on docker toolbox for windows?

Currently when I try to run the steps listed in the repo I get the error below:

$ docker-compose -f common/docker-compose.yml up
Creating common_licensingservice_1
Attaching to common_licensingservice_1
licensingservice_1 | /bin/sh: ./run.sh: not found
common_licensingservice_1 exited with code 127



I had this problem on windows and rectified it by removing spaces after a "\" as below.
So check that each "\" is the last character on the line

cho "********************************************************"
echo "Starting Zuul Service with Configuration Service via Eureka :  $EUREKASERVER_URI" ON PORT: $SERVER_PORT;
echo "********************************************************"
java -Djava.security.egd=file:/dev/./urandom -Dserver.port=$SERVER_PORT   \
     -Deureka.client.serviceUrl.defaultZone=$EUREKASERVER_URI   \
     -Dspring.cloud.config.uri=$CONFIGSERVER_URI   \
     -Dspring.profiles.active=$PROFILE                          \
     -Dspring.zipkin.baseUrl=$ZIPKIN_URL                       \
     -jar /usr/local/zuulservice/@project.build.finalName@.jar

John C Carnell (44) [Avatar] Offline
#6
Hi Kkeller

Sorry I did not get back to you sooner. I have been heads down finishing the last minute edits for the book. You should be able to run this on windows toolbox. Unfortunately, I am a Linux and OS X user so I never had a windows box to test the code on. Can you tell me the line where I have the space you are referring to, because I checked my code and it seems to be fine. If you havent done so recently, you might want to pull down the latest source to see if I inadvertently cleaned it up.

Thanks,
John