Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

docker - How to pass argument on pre-defined Entrypoint of an image?

I have to use a custom docker image, which defines Entrypoint like this:

.
.
"Entrypoint": [
    "tini",
    "-g",
    "--"
],
.
.

If I run docker-compose up without specifying any argument for this, it exited like this:

ml4t    | tini (tini version 0.18.0)
ml4t    | Usage: tini [OPTIONS] PROGRAM -- [ARGS] | --version
ml4t    |
ml4t    | Execute a program under the supervision of a valid init process (tini)
ml4t    |
ml4t    | Command line options:
ml4t    |
ml4t    |   --version: Show version and exit.
ml4t    |   -h: Show this help message and exit.
ml4t    |   -p SIGNAL: Trigger SIGNAL when parent dies, e.g. "-p SIGKILL".
ml4t    |   -v: Generate more verbose output. Repeat up to 3 times.
ml4t    |   -w: Print a warning when processes are getting reaped.
ml4t    |   -g: Send signals to the child's process group.
ml4t    |   -e EXIT_CODE: Remap EXIT_CODE (from 0 to 255) to 0.
ml4t    |   -l: Show license and exit.
ml4t    |
ml4t    | Environment variables:
ml4t    |
ml4t    |   TINI_VERBOSITY: Set the verbosity level (default: 1).
ml4t    |   TINI_KILL_PROCESS_GROUP: Send signals to the child's process group.
ml4t    |
ml4t exited with code 1

I realized that I have to pass bash to this tini command. How can I do this without creating a new Dockerfile?

question from:https://stackoverflow.com/questions/66058825/how-to-pass-argument-on-pre-defined-entrypoint-of-an-image

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

use docker-compose run instead of up.

Doc: https://docs.docker.com/compose/reference/run/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...