uber-archive/makisu

Environment variable in ENTRYPOINT is not substituted with its value at runtime

antonsergeyev opened this issue · 6 comments

Describe the bug
An environment variable used in ENTRYPOINT is not substituted with its value at runtime.

To Reproduce
Assume a dockerfile:

FROM alpine:latest
ENTRYPOINT echo ${MESSAGE}

Build it with docker (works as expected):

docker build -t makisu-echo-docker .
docker run -e MESSAGE=hello makisu-echo-docker
>hello

Build it with makisu (unexpected output):

makisu_build -t makisu-echo .
docker run -e MESSAGE=hello makisu-echo
>${MESSAGE} /bin/sh

Expected behavior
I expect ENTRYPOINT to change dynamically with respect to the environment variable.
The output above should be "hello".

Additional context
I'm using makisu 0.1.12 and docker 19.03.3

This is also an issue that I am having!

This bug may lie inside the lib/parser/dockerfile/replace_variables.go file but I might be mistaken.

I will take a look at this later this week.

EDIT: Not at all inside the replace_variables file.

It looks like docker create the following Entrypoint:

[
  "/bin/sh",
  "-c",
  "echo ${MESSAGE}"
]

And makisu:

[
  "echo",
  "${MESSAGE}"
]

EDIT: A simple workaround until this is fixed is to use this syntax for the entrypoint: from the dockerfile ref

Anothre PR to handle the CMD directive that also needs this mechanism: #323

@yiranwang52 You can close this I think

Yes, thanks for fixing this.