Pass ARG to ENTRYPOINT

Alexander Mills

Say I have this in a Dockerfile:

ARG FOO=1
ENTRYPOINT ["docker.r2g", "run"]

where I build the above with:

docker build -t "$tag" --build-arg FOO="$(date +%s)" .

is there a way to do something like:

ENTRYPOINT ["docker.r2g", "run", ARG FOO]  // something like this

I guess the argument could also be passed with docker run instead of during the docker build phase?

VonC

You could combine ARG and ENV in your Dockerfile, as I mention in "ARG or ENV, which one to use in this case?"

ARG FOO
ENV FOO=${FOO}

That way, you docker.r2g can access the ${FOO} environment variable.

I guess the argument could also be passed with docker run instead of during the docker build phase?

That is also possible, if it makes more sense to give FOO a value at runtime:

docker run -e FOO=$(...) ...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to pass ARG value to ENTRYPOINT?

pass parameters to entrypoint in the docker

docker run pass arguments to entrypoint

Dcokerfile pass ENV to ENTRYPOINT or CMD

Pass arg to docker build

Pass arg while importing

Lua function with arg pass to another function with arg

How to pass the this arg to javascript function

Pass NULL argument with JQ --arg

Convert arg to uppercase to pass as variable

How to pass argument to ENTRYPOINT with variable expansion?

Can I pass arguments to the entrypoint of a SageMaker estimator?

Pass environment variables as input to Docker entrypoint

pyspark: Valid strings to pass to dataType arg of cast()

pass user arg to DESeq2 function

How to pass date arg to my cloudbuild yaml

Is there a way to pass multiple CMD to Dockerfile as ARG?

Pass button text to command as arg with tkinter button

LLDB pass bash command output as arg to application

How do you pass arguments to docker run entrypoint?

How do I override the entrypoint and pass Bash commands as a string?

How to pass Java_opts before an executable to entrypoint in dockerfile?

How to pass Port number from docker-compose and use it in Entrypoint?

how to pass arguments to docker run command specific to few scripts but not to entrypoint

C# pass arguments with flags (/arg1 /arg2) to an exe

Pass Bash comma delimited string values variable to jq arg filter

How to pass `directory` arg to Python 3 `http.server`?

How to pass jvm arg to java app distribution created with gradle

How to pass an ARG to a Dockerfile in a docker-compose.yml