mnestor / docker-swarm-devices

9 stars 2 forks source link

WTF Is this garbage? #1

Closed mnestor closed 1 year ago

mnestor commented 4 years ago

https://github.com/mnestor/docker-swarm-devices/blob/c6e02457adb1b77a094eb7313bf9ddc2f1e5ee82/swarm-hack.yml#L27

Okay so we wrap EOF in quotes so that it won't process $() or `` in the following here-doc

We also do the & to put the docker run command into the background. Why?!?!? Because if we detach then the here-doc won't be processed.

Why do we have to background it though?

Because for some reason it wouldn't get the signal to exit so we have to trap that ourselves and tell the container to stop and we can't trap the signal if docker run is in the foreground.