You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Europa: docker.#Run entrypoint behavior does not seem to match docker run cli #1555
The default behavior of docker run when no --entrypoint is provided, and ENTRYPOINT[] has not been overridden is to use /bin/sh -c. This allows CMD to be easily processed through the shell. Overridding entrypoint allows for bootstrapping scripts to do setup, perhaps export some necessary env vars, then exec "$@" as one example.
The current implementation does not seem to allow providing a direct entrypoint to use besides the one in image config. From docker.#Run._exec:
In the above code, cmd is always exec'd without a shell which is fine, but the only way to use entrypoint and arbitrary commands together is to set them in the image config which by the nature of immutable configs you must do so via engine.#Set which can be verbose and confusing.
It seems that docker.#Run should provide an entrypoint field; if this field is _|_ then image.config.entrypoint is used instead, and if that is _|_ then docker.#Run defaults to what? /bin/sh -c ? or nothing?
One use case for a custom entrypoint is from my current universe/aws where I want to bootstrap the configuration so that any command that leverages the AWS SDK (including the CLI, CDK, custom python/boto3 scripts, can execute and gain access to credentials and config:
This would then allow any arbitrary command to be execute after the config is setup. It's meant to be a convenience to the user so they can just provide their command.
To use (abridged version):
mounts: scripts: dest: '/scripts'entrypoint: '/scripts/bootstrap.sh'cmd: name: string// any command that uses an AWS SDK that pulls config from those env vars
The way I understand it, the shell is only added to entrypoint when you use the shell-form in a Dockerfile. It's the same with CMD. In the spec, both end up as arrays. And when running, one is just appended to the other.
In effect, in dagger, you could use command: name as the entrypoint, but you're right we should have a field that overrides the entrypoint in the image.
To answer the last question, if no entrypoint is set either in #ImageConfig or docker.#Run, then nothing should be prepended to dagger.#Exec: args.
Activity
talentedmrjones commentedon Feb 4, 2022
One use case for a custom
entrypointis from my currentuniverse/awswhere I want to bootstrap the configuration so that any command that leverages the AWS SDK (including the CLI, CDK, custom python/boto3 scripts, can execute and gain access to credentials and config:/scripts/bootstrap.shThis would then allow any arbitrary command to be execute after the config is setup. It's meant to be a convenience to the user so they can just provide their command.
To use (abridged version):
helderco commentedon Mar 15, 2022
The way I understand it, the shell is only added to entrypoint when you use the shell-form in a Dockerfile. It's the same with
CMD. In the spec, both end up as arrays. And when running, one is just appended to the other.In effect, in dagger, you could use
command: nameas the entrypoint, but you're right we should have a field that overrides the entrypoint in the image.To answer the last question, if no entrypoint is set either in
#ImageConfigordocker.#Run, then nothing should be prepended todagger.#Exec: args.