ansible-container icon indicating copy to clipboard operation
ansible-container copied to clipboard

How to run multiple "commands" after container is started

Open binithlighting opened this issue 6 years ago • 2 comments

ISSUE TYPE
  • Documentation Report
container.yml
settings:
  conductor_base: ubuntu:16.04

services:

  hse25.0_rc1_85_2105:
    roles:
     - hse25.0_rc1_85_2105
    ports:
     - "8025:80"
     - "2105:2100/udp"
     - "44325:443"
     - "8425:8843"
    command: ["/bin/sh", "-c", "/root/hse/hse.sh -test" , "-test", "mystate"]
    command: ["/bin/sh", "-c", "echo" , "hellow"]
OS / ENVIRONMENT

Ansible Container, version 0.9.2 Linux, dockerbox-1, 4.13.0-32-generic, #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018, x86_64 2.7.12 (default, Nov 20 2017, 18:23:56)

##### SUMMARY
I am not able to figureout how to run an additional command after the container has started.
I think the way described in the container.yml(pasted above) is wrong, as it contains two "command" directives.

To be specific, I am looking for something like a "post-container-start" directive, or a way to run multiple commands. Ofcourse an option is to put all the required commands in a single shell script, but just wondering if there is another way.

##### STEPS TO REPRODUCE
Add a seconds command directive in container.yml

##### EXPECTED RESULTS
Run two (or more) commands, one after the other

##### ACTUAL RESULTS

Container wont start

binithlighting avatar Apr 09 '18 10:04 binithlighting

Untested but I guess it works here too: https://github.com/docker-library/redmine/issues/52#issuecomment-269431168

re-mscho avatar Apr 12 '18 12:04 re-mscho

@binithlighting Did you try advise by @re-mscho ?

Voronenko avatar Jun 19 '18 12:06 Voronenko