Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image has no entry point #52

Closed
dsyer opened this issue Oct 15, 2018 · 12 comments
Closed

Image has no entry point #52

dsyer opened this issue Oct 15, 2018 · 12 comments

Comments

@dsyer
Copy link

dsyer commented Oct 15, 2018

This used to work. Not sure what changed, but I don't think it was anything I did.

$ pack build dsyer/app --builder dsyer/builder --no-pull
$ docker run -p 8080:8080 dsyer/app
docker: Error response from daemon: No command specified.
See 'docker run --help'.
$ docker inspect dsyer/app
...
            "Entrypoint": null,
...

The image is fine apart from the entry point, so I can run it if I provide on manually, i.e. docker run dsyer/app /lifecycle/launcher web.

@nebhale
Copy link
Contributor

nebhale commented Oct 15, 2018

Yeah, this definitely seems to be a regression. We'd talked about removing the defaulting of web, but the Entrypoint shouldn't have been removed.

@sclevine
Copy link
Member

Are you using a base image that sets PACK_PROCESS_TYPE? Without that env var, no ENTRYPOINT will get set.

@ssisil ssisil added this to Icebox in Planning Board via automation Oct 15, 2018
@ekcasey
Copy link
Member

ekcasey commented Oct 15, 2018

@sclevine I thought the entrypoint should always be the launcher regardless of PACK_PROCESS_TYPE. I think right now app images are inheriting that entrypoint from the stack run image https://github.com/buildpack/lifecycle/blob/master/images/run/Dockerfile#L14. Is this something we would want the exporter to do in the future? In either case, I think we should clarify the contract between the stack and the lifecycle.

@dsyer setting entrypoint on your stack run image should fix the issue.

@sclevine
Copy link
Member

@ekcasey We're both half-right. The current stacks set the ENTRYPOINT of the run image, but the spec says that the exporter should do this: https://github.com/buildpack/spec/blob/master/buildpack.md#phase-4-export

I opened an issue against the spec here: buildpacks/spec#15

@dsyer
Copy link
Author

dsyer commented Oct 16, 2018

setting entrypoint on your stack run image should fix the issue.

Do I know what the run image is?

UPDATE: Found it in ~/.pack/config.toml.

@sclevine
Copy link
Member

Update from WG meeting on 2018-10-16:

We decided that the exporter should be responsible for adding the launcher to the run image and setting the ENTRYPOINT (during the export phase).

This is important to guarantee that the builder and launcher lifecycle components are always compatible for a given image.

Will follow up with a PR for buildpacks/spec#15.

@sclevine
Copy link
Member

sclevine commented Jan 2, 2019

The pack CLI now handles this correctly.

@sclevine sclevine closed this as completed Jan 2, 2019
@ekcasey
Copy link
Member

ekcasey commented Jan 3, 2019

@sclevine This work correctly on master of lifecycle but I believe we need to release new v3alpha2 images before pack will handle this correctly

@sclevine sclevine removed this from Icebox in Planning Board Jan 27, 2019
@jicowan
Copy link

jicowan commented May 3, 2019

@sclevine I wrote a simple Python Tornado application. When I tried running the image that the buildpack created I got the following error:

Error: failed to launch: determine start command: process type web was not found

The entrypoint is set to:

"Entrypoint": [
                "/lifecycle/launcher"
            ],

If I run:

docker run -it -d -p 8080:8888 tornado:v1.0 python main.py

then it works. Is this expected?

@sclevine
Copy link
Member

sclevine commented May 3, 2019

This is the expected behavior when the buildpack doesn’t set a start command. What buildpack are you using? Python doesn’t have a widely adopted convention for an entry file, so Python buildpacks often don’t set a default command.

@jicowan
Copy link

jicowan commented May 3, 2019

Is there a way to tell whether the buildpack sets a start command? I see that a Dockerfile is not generated when you do a build. I'm using the Heroku buildpacks. I think it selected 18 if that makes sense.

@sclevine
Copy link
Member

sclevine commented May 3, 2019

It’s the buildpack’s responsibility to warn you. @hone works at Heroku and might be able to direct your question to the right folks.

As a workaround, you could use docker inspect to examine the CMD property.

(We generate OCI images without using Dockerfiles at all. This lets us reuse arbitrary layers from previous builds and avoid downloading layers that only need to be reused at runtime. It also means we can build reproducible images in unprivileged containers.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants