#Unset entrypoint?

1 messages · Page 1 of 1 (latest)

frozen harness
#

Hey, I've got a situation where I would like to "unset" the entrypoint provided by another image (to run tests). At this point, it doesn't seem like this is possible. I've tried setting it to a blank string and I've tried using /bin/bash -c and /bin/sh -c and nothing seems to get it to the blank slate again.

tidal ether
frozen harness
#

ah I didn’t see it in the docs for the NodeJS SDK; is this new?

tidal ether
#

I don’t think so - but maybe it didn’t get shipped? let me check

scarlet rune
#

@tidal ether I don't recall having a WithoutEntrypoint. Having said that, setting the WithEntryPoint to something blank should work.

    digest, err := client.Container().From("nginx").
        WithEntrypoint([]string{"echo", "hello"}).
        WithDefaultArgs(dagger.ContainerWithDefaultArgsOpts{Args: []string{""}}).
        Publish(ctx, "ttl.sh/marcosnils:nginxtest")

#

^ that resets the entrypoint to "echo hello"

tidal ether
#

oh that’s what it was!

solar crescent
tidal ether
solar crescent
#

Yep, WithEntrypoint(nil) and WithDefaultArgs(). for entrypoint and default args. If either one of those is set, it'll run as a default command.

tidal ether
scarlet rune
#

I just checked and WithEntrypoint(nil) doesn't do anything

tidal ether
#

I think technically it's WithEntrypoint([]string{})

#

The GraphQL spec doesn't allow a null args value

scarlet rune
#

WithEntrypoint([]string{}) also doesn't change it

solar crescent
#

Yeah, but the Go SDK has turned nil into the empty []string{} via marshaling. So in Go it should be equivalent.

tidal ether
#

Seems to work

solar crescent
scarlet rune
#
    digest, err := client.Container().From("nginx").
        WithEntrypoint([]string{}).
        Publish(ctx, "ttl.sh/marcosnils:nginxtest")

^ if you run that image afterwards, the nginx default entrypoint is kept

solar crescent
scarlet rune
solar crescent
#

Don't need the empty string. That's not empty args. It's a list with an empty value.

tidal ether
#

Oh, sorry I didn't check to see if the removed entrypoint is applied to a pushed image. Only tested with immediate execution

solar crescent
#

So WithEntrypoint([]string{}) rather than WithEntrypoint([]string{""}).

tidal ether
#

docker pull ttl.sh/marcosnils:solomontest@sha256:9f7396c3c2e63e423153df613c434cfa0212523d7049c8c55c2dc23576cdda62

#

Side note: add a ttl.sh module to zenith 😛

scarlet rune
#

I keep doing tests so you might be getting inconsistent outputs 😬

#

but yes, both WithEntrypoint(nil) and WithEntrypoint([]string{}) will set the OCI spec to Entrypoint:null as Helder was correctly pointing out

#

@frozen harness let us know if this helps with your current issue and if you need further help 🙏

solar crescent
#

To reset the default args I believe all you need is WithDefaultArgs() since that argument is optional.

frozen harness
#

ill give it a shot tomorrow

frozen harness
#

this worked:

.withEntrypoint([])

I'd expect to be able to pass null here (this is the Node SDK) to unset it; it makes sense when you think about it for a few minutes but it's a little counterintuitive when you are first encountering it.

Thanks for the help, I can reset it now.

#

@scarlet rune ^

tidal ether
#

@frozen harness thanks for the feedback, I agree. We should 1) support null and 2) add withoutEntrypoint IMO

scarlet rune
frozen harness
frozen harness
#

sorry that took a while, just added the issue