Nori
Nori

Reputation: 3022

How can I do multi CMD in docker?

I want to do this 2 command.

CMD ["supervisord", "-n",]
CMD ["busybox" , "crond", "-b", "-L", "/dev/stderr"]

I know work only last CMD. So I tried these command one by one.But it doesn't work.

CMD ["supervisord", "-n", "&&" , "busybox" , "crond", "-b", "-L", "/dev/stderr"]

CMD ["supervisord", "-n", ";" , "busybox" , "crond", "-b", "-L", "/dev/stderr"]

CMD supervisord -n; busybox crond -b -L /dev/stderr

If you know how to solve this problem please tell me!

Upvotes: 3

Views: 216

Answers (2)

Popmedic
Popmedic

Reputation: 1871

You could add a shell script, for bash:

#!/usr/bin/env bash
# file: startup.sh
supervisord -n
busybox crond -b -L /dev/stderr

then in dockerfile do:

...
COPY startup.sh /startup.sh
RUN chmod 744 /startup.sh
...
CMD ["/startup.sh"]

Upvotes: 2

brandon-barnett
brandon-barnett

Reputation: 1095

Can you run both commands on the same line?

CMD supervisord -n && busybox crond -b -L /dev/stderr

Upvotes: 1

Related Questions