containous / traefik-library-image

ARCHIVED
https://github.com/traefik/traefik-library-image
Apache License 2.0
219 stars 60 forks source link

v1.2.3-alpine fails with "Error parsing command: pflag: help requested" #9

Closed msgeissler closed 7 years ago

msgeissler commented 7 years ago

I wanted to switch from the v1.2.3 docker image to the v1.2.3-alpine image. Unfortunately I am unable to start the container with the alpine image.

The container quits with the following error: Error parsing command: pflag: help requested

Please note that traefik works fine when switching back to v1.2.3.

timoreimann commented 7 years ago

Could you please paste your entire CLI input and the complete response you get from Traefik?

msgeissler commented 7 years ago

I am using docker for traefik, so the CLI input should be provided by the docker image. The response I can see in the docker log is the help overview for traefik.

I just had a quick look at the dockerfile and noticed major differences between the normal and alpine dockerfile. The alpine one uses an entrypoint-script and defaults to the CMD --help. Maybe thats the problem? The normal dockerfile uses traefik directly as the entrypoint.

Do we have to manually overwrite the command used for the alpine images in contrast to the normal image?

timoreimann commented 7 years ago

Looking at the entrypoint script, it looks like you either have to pass an option or a sub-command in order to overwrite the default help screen. It does seem a bit inconvenient on first sight because you apparently can't fire off Traefik without any parameters at all (i.e., rely on defaults all the way).

@emilevauge can you confirm? Are we missing something? Should we try to make both Alpine and scratch Dockerfiles consistent with regards to the ENTRYPOINT / CMD parts?

msgeissler commented 7 years ago

Any update on the topic?

timoreimann commented 7 years ago

ping @emilevauge (see my last message above)

emilevauge commented 7 years ago

@msgeissler please add a subcommand. I add to do this in the alpine image to stay consistent with Docker guidelines: https://github.com/docker-library/official-images/pull/2367#issuecomment-261605158 Can I close this issue ?

msgeissler commented 7 years ago

@emilevauge sure. I guess this will be consistent across the different images and be updated in the docker-hub page in a future update?

The currently inconsistent behaviour between the images is still something I would consider a bug though (and is a problem according to the linked documentation).

mdhwoods commented 7 years ago

i have the same problem. is there a work around? trying to trouble shoot an issues and i need terminal access.

thanks

timoreimann commented 7 years ago

@mdhwoods does adding a sub-command per Emile's suggestion help?

mdhwoods commented 7 years ago

@timoreimann what subcommand would launch bash or traefik? tried docker run -d traefik:1.3.2-alpine /bin/bash is my syntex incorrect?

thanks

mdhwoods commented 7 years ago

@timoreimann got it, just needed ash or traefik at the end. got it going.

timoreimann commented 7 years ago

@ldez AFAIU @emilevauge, the inconsistency isn't a bug but something that the conventions for the Alpine require us to do. Do you agree? If so, shall we close this issue, or is there anything else to do (maybe documenting things better)?

emilevauge commented 7 years ago

the inconsistency isn't a bug but something that the conventions for the Alpine require us to do

Not Alpine, but Docker images. As our main official image is based on from scratch, we cannot do docker run -it traefik:1.3.2 bash, so this leads to inconsistencies between from scratch and alpine based image. That's why I was asked to add https://github.com/containous/traefik-library-image/blob/master/alpine/entrypoint.sh in the alpine image which by default, prints Traefik help without any flag. What do you suggest? Like in Alpine image, print help by default when no arg is given in the from scratch image (breaking change)?

ulope commented 7 years ago

I don't really understand this discussion. The readme on docker hub gives the following example:

docker run -d -p 8080:8080 -p 80:80 \
-v $PWD/traefik.toml:/etc/traefik/traefik.toml \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik

This should work no matter what.

ldez commented 7 years ago

We use the same behavior as scratch on 1.3.8 for alpine.

All subsequent versions will work like that.