Skip to content

Use entrypoint instead of cmd #707

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

Closed
wants to merge 3 commits into from
Closed

Conversation

gleichda
Copy link

Thank you for the pull request!

Fixes #706

Please make sure you didn't directly change README.md: it should be changed only by changing README.tmpl.md and running make README.md.

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2019

CLA assistant check
All committers have signed the CLA.

@gleichda
Copy link
Author

Anybody an idea why my Travis Test is failing? I did not change go code

@jirfag
Copy link
Contributor

jirfag commented Sep 23, 2019

hi, thank you, see also #245. We should choose the one way :)
/cc @amenzhinsky

@amenzhinsky
Copy link

I don't see any reason to change it to ENTRYPOINT since it's meant wrap commands setting up the environment.

BTW the issue is irrelevant, docker run --rm golangci/golangci-lint run does what it's supposed to, run run executable, not golangci-lint run

@gleichda
Copy link
Author

gleichda commented Sep 23, 2019

@amenzhinsky
From my point I can not confirm that it is working (Tested on Linux and OSX):

gleichd@cloudshell:~$ $ docker pull golangci/golangci-lint:latest
latest: Pulling from golangci/golangci-lint
Digest: sha256:b1d67f5ceba3509fe5810aaf91e907fc4b0f3e44f64153a0db5b535bcaf93999
Status: Image is up to date for golangci/golangci-lint:latest
docker.io/golangci/golangci-lint:latest
gleichd@cloudshell:~$ $ docker run --rm golangci/golangci-lint run
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"run\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled
gleichd@cloudshell:~$ $

With my new image:

gleichd@cloudshell:~/Projects/Privat/golangci-lint$ $ make build
GO111MODULE=on go mod verify
all modules verified
GO111MODULE=on go mod tidy
go build -o golangci-lint ./cmd/golangci-lint
gleichd@cloudshell:~/Projects/Privat/golangci-lint$ $ docker build -t golangci:local .
Sending build context to Docker daemon  73.43MB
Step 1/3 : FROM golang:1.13
1.13: Pulling from library/golang
4a56a430b2ba: Pull complete
4b5cacb629f5: Pull complete
14408c8d4f9a: Pull complete
ea67eaa7dd42: Pull complete
a2a2197e145e: Pull complete
36ac8c11a11f: Pull complete
ecd7d9a67e26: Pull complete
Digest: sha256:90d554b5ae59cb63d2bf42bdfcd60aa1feb4794d9e3a9cbb9d2deb477c088be0
Status: Downloaded newer image for golang:1.13
 ---> c4d6fdf2260a
Step 2/3 : COPY golangci-lint /usr/bin/
 ---> 6d62c9c8b90c
Step 3/3 : ENTRYPOINT ["golangci-lint"]
 ---> Running in f45c480b92d9
Removing intermediate container f45c480b92d9
 ---> 0fbb12f59ef8
Successfully built 0fbb12f59ef8
Successfully tagged golangci:local
gleichd@cloudshell:~/Projects/Privat/golangci-lint$ $ docker run --rm golangci:local run
level=error msg="Running error: context loading failed: no go files to analyze"
gleichd@cloudshell:~/Projects/Privat/golangci-lint$ $

@gleichda
Copy link
Author

Validated with the new 1.19.0 release also this morning

@amenzhinsky
Copy link

amenzhinsky commented Sep 24, 2019

This is not a bug, this is a misuse.

With this merged all current CI jobs that override CMD will be broken, all scripts such as docker run -it golangci-lint:latest golangci-lint run --enable-all will end up being golangci-lint golangci-lint run --enable-all and crush.

More that that some CIs don't provide ability to override entrypoints, such as old gitlab installations.

This is a question of backward compatibility and not saving one golangci-lint command executing it from the docker image.

@jirfag
Copy link
Contributor

jirfag commented Sep 24, 2019

@amenzhinsky I agree about backward compatibility, therefore closing the issue.

@jirfag jirfag closed this Sep 24, 2019
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

Successfully merging this pull request may close these issues.

Docker run fails on Mac
4 participants