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

Nginx Plus - Building Docker Image to Private Repo using Windows 10 and CMDR #927

Closed
ksummersill2 opened this issue Apr 18, 2020 · 3 comments

Comments

@ksummersill2
Copy link

ksummersill2 commented Apr 18, 2020

When I was trying to build the docker container from the 1.6.3 repo as described into the documentation. The Makefile did not work. This is because the makefile does not use proper absolute path. Another reason why the makefile fails is because of using double quotes on the arguments used to build the image.

Specs:
Windows 10 Pro
CMDR Terminal
Using the Git Repo: https://github.com/nginxinc/kubernetes-ingress/
Followed the instructions here:
https://docs.nginx.com/nginx-ingress-controller/installation/building-ingress-controller-image/

The error that showed up:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: the working directory 'C:/Program Files/Git/go/src/github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress/' is invalid, it needs to be an absolute path. See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'. make: *** [Makefile:25: nginx-ingress] Error 125

Expected Behavior:
To probably build the image from the repo.

FIX: I was able to fix this by updating the Makefile by doing the following:
I updated to provide the absolute path:
CURRENT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) $(info Current Directory: $(CURRENT_DIR))

DOCKER_TEST_RUN = docker run --rm -v $(CURRENT_DIR):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress DOCKER_BUILD_RUN = docker run --rm -v $(CURRENT_DIR):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress/

Then I was still getting an error message. So then I determined that it was because of the double quotes in the argument. Fixed by doing:
$(DOCKER_BUILD_RUN) -e CGO_ENABLED=0 -e GO111MODULE=on -e GOFLAGS='$(GOFLAGS)' $(GOLANG_CONTAINER) go build -installsuffix cgo -ldflags '-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}' -o /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress

Issue: Now I am running into this issue and not sure why the template is within the docker container: F0418 16:01:31.602234 1 main.go:234] Error creating TemplateExecutor: open nginx-plus.tmpl: no such file or directory

Question: Can i get a free T-shirt lol. 😀

@pleshakov
Copy link
Contributor

Hi @ksummersill2

We recently improved the process of building NGINX Plus image: the Docker no longer uses volume mounts and instead usex multi-state Docker build instead. #825

That was done largely because of the feedback we had heard from Windows users. They would encounter errors during Docker build.

Unfortunately, that improvement is not part of 1.6.3 release. However, it will be part of the 1.7.0 release. You can already try it if you use the edge version (source from the master branch).

@ksummersill
Copy link

@pleshakov I've tried 1.6.3 on Ubuntu as well and got the same result. I changed to use absolute paths and am really having issues with the templates being found. I will try to use the edge version.

@ksummersill2
Copy link
Author

@pleshakov So that woked! Thank you! Recommend updating the documentation to use 1.7 period!

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

3 participants