Multiple commands on docker ENTRYPOINT

后端 未结 2 1515
说谎
说谎 2020-12-06 09:35

I\'m trying to build a custom tcserver docker image. But I\'m having some problems starting the webserver and the tomcat.
As far as I understand I should use ENTRYPOINT

相关标签:
2条回答
  • In case you want to run many commands at entrypoint, the best idea is to create an bash file. For example commands.sh like this

    #!/bin/bash
    mkdir /root/.ssh
    echo "Something"
    cd tmp
    ls
    ...
    

    And then, in your DockerFile, set entrypoint to commands.sh file (that execute and run all your mands inside)

    COPY commands.sh /scripts/commands.sh
    RUN ["chmod", "+x", "/scripts/commands.sh"]
    ENTRYPOINT ["/scripts/commands.sh"]
    

    After that, each time you start your container. commands.sh will be execute and run all commands that you need. You can take a look here https://github.com/dangminhtruong/drone-chatwork

    0 讨论(0)
  • 2020-12-06 10:27

    You can use npm concurrently package.

    For e.g.

    ENTRYPOINT ["npx","concurrently","command1","command2"]
    

    It will run them in parallel.

    0 讨论(0)
提交回复
热议问题