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

kompose build fails to read the context correctly #832

Closed
surajssd opened this issue Sep 27, 2017 · 3 comments
Closed

kompose build fails to read the context correctly #832

surajssd opened this issue Sep 27, 2017 · 3 comments
Assignees
Labels
component/Kubernetes kind/bug Categorizes issue or PR as related to a bug.

Comments

@surajssd
Copy link
Member

Problem

kompose fails to find the Dockerfile even if the dockerfile is set under build and context is also set.

How to reproduce?

Please see the following directory structure

$ tree
.
├── docker-compose.yml
├── example
│   └── db.json
├── glide.lock
├── glide.yaml
├── LICENSE
├── main.go
├── Makefile
├── output.json
├── parsego.go
├── README.md
├── scripts
│   ├── Dockerfile
│   ├── entrypoint.sh
│   └── k8s-release
├── spec.go
├── swagger.json
└── vendor
    ├── github.com
    │   ├── davecgh
...

I am trying to do a build with Dockerfile being in scripts directory. But my build context is root of the project. Essentially I am running a build command as following:

docker build -t surajd/kedgeschema -f ./scripts/Dockerfile .

Above works fine.

To make it easier I have created docker-compose file which looks like following:

$ cat docker-compose.yml 
version: "2"
services:
  gen:
    build:
      context: .
      dockerfile: scripts/Dockerfile
    image: surajd/kedgeschema

docker-compose works on this:

$ docker-compose up
Building gen
Step 1/11 : FROM golang:1.9.0 AS build-env
...

But kompose fails as

$ kompose up
INFO Build key detected. Attempting to build and push image 'surajd/kedgeschema' 
INFO Building image 'surajd/kedgeschema' from directory 'json-schema-generator' 
FATA Error while deploying application: k.Transform failed: Unable to build Docker image for service gen: Unable to build image. For more output, use -v or --verbose when converting.: API error (500): {"message":"Cannot locate specified Dockerfile: Dockerfile"}

Versions

$ kompose version
1.2.0 (8efe274)

Other info

The project I am trying that docker-compose file is https://github.com/kedgeproject/json-schema-generator

@surajssd surajssd added kind/bug Categorizes issue or PR as related to a bug. component/Kubernetes labels Sep 27, 2017
@surajssd
Copy link
Member Author

In dockerlib.BuildImageOptions also set Dockerfile field as relative path to context.

I have tried something similar in https://github.com/kedgeproject/kedge/pull/295/files#diff-f9c1aac2b0fdb0b76e7a167cb362d95cR93

@surajnarwade
Copy link
Contributor

Thanks @surajssd for pointing this out, will send a fix very soon :)

surajnarwade added a commit to surajnarwade/kompose that referenced this issue Oct 5, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Oct 6, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Oct 9, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
@surajnarwade surajnarwade added this to the 1.3.0 release milestone Oct 9, 2017
@cdrage cdrage modified the milestones: 1.3.0 release, 1.4.0 release Oct 10, 2017
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Oct 11, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
@surajnarwade surajnarwade self-assigned this Oct 11, 2017
@cdrage cdrage modified the milestones: 1.4.0 release, 1.5.0 release Oct 31, 2017
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Nov 8, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Nov 20, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Nov 30, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Nov 30, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Dec 1, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
surajnarwade added a commit to surajnarwade/kompose that referenced this issue Dec 1, 2017
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue kubernetes#832.
This PR will fix the issue.
@surajnarwade
Copy link
Contributor

we can close this issue now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/Kubernetes kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants