How to pass arguments to Shell Script through docker run

后端 未结 7 1911
灰色年华
灰色年华 2020-11-30 17:49

I am new to the docker world. I have to invoke a shell script that takes command line arguments through a docker container. Ex: My shell script looks like:

#         


        
相关标签:
7条回答
  • 2020-11-30 18:32

    If you want to run it @build time :

    CMD /bin/bash /file.sh arg1
    

    if you want to run it @run time :

    ENTRYPOINT ["/bin/bash"]
    CMD ["/file.sh", "arg1"]
    

    Then in the host shell

    docker build -t test .
    docker run -i -t test
    
    0 讨论(0)
提交回复
热议问题