What does set -e and exec “$@” do for docker entrypoint scripts?

后端 未结 3 1392
一整个雨季
一整个雨季 2020-11-29 18:08

I\'ve noticed that many entrypoint.sh scripts for docker do something like this:

#!/bin/bash
set -e

... code ...

exec \"$@\"

What are the

3条回答
  •  忘掉有多难
    2020-11-29 18:35

    It basically takes any command line arguments passed to entrypoint.sh and execs them as a command. The intention is basically "Do everything in this .sh script, then in the same shell run the command the user passes in on the command line".

    See:

    • What are the special dollar sign shell variables?
    • Need explanations for Linux bash builtin exec command behavior

提交回复
热议问题