Consider a snippet:
---
version: '3.4'
services:
app:
image: my_image
command: ["sleep", "60s", "&&", "my_command"]
Gives me:
sleep: invalid time interval �my_command’
Try 'sleep --help' for more information.
What is wrong? Why did this happen?
Docker version 19.03.2, build 6a30dfc
Host OS - windows 10
You may use it like this to run sleep 60
followed by your command:
---
version: '3.4'
services:
app:
image: my_image
command: sh -c "
sleep 60 &&
my_command"
When you run command: ["sleep", "60s", "&&", "my_command"]
it passes all the arguments from position 2 onwards to sleep
command. It is actually attempting to run your command as:
sleep '60s' '&&' 'uname'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With