|
1 | 1 | --- |
2 | 2 | title:"No Dockerfile found" |
3 | | -description:"" |
| 3 | +description:"Failed to fetch the Dockerfile from path" |
4 | 4 | group:troubleshooting |
5 | 5 | sub_group:common-issues |
6 | 6 | redirect_from: |
7 | 7 | -/docs/no-dockerfile-found/ |
8 | 8 | toc:true |
9 | 9 | --- |
10 | | -***Problem:*** When I tried to build a repository, I received this error message: “Repository does not contain a Dockerfile. Please check the pipeline configuration”. |
11 | | - |
12 | | -{% include |
13 | | -image.html |
14 | | -lightbox="true" |
15 | | -file="/images/92c8d50-2016-09-29_12-29-10.png" |
16 | | -url="/images/92c8d50-2016-09-29_12-29-10.png" |
17 | | -alt="2016-09-29_12-29-10.png" |
18 | | -max-width="40%" |
19 | | -caption="This error indicates that the repository doesn’t have a Dockerfile in it or the path for the Dockerfile was incorrect." |
20 | | -%} |
21 | | - |
22 | | -***Solution:*** There are two ways to address this error: |
23 | | - |
24 | | -{:start="1"} |
25 | | -1. Add a Dockerfile to the repository or verify that you configured the correct path to the Dockerfile. |
26 | | - |
27 | | - To configure the Dockerfile path in the pipeline configuration, navigate to**`Repositories`**→**`Your Repository`**→**`Pipelines`**. |
28 | | - |
29 | | -{% include |
30 | | -image.html |
31 | | -lightbox="true" |
32 | | -file="/images/3c8f08e-2016-09-29_12-57-55.png" |
33 | | -url="/images/3c8f08e-2016-09-29_12-57-55.png" |
34 | | -alt="2016-09-29_12-57-55.png" |
35 | | -max-width="40%" |
36 | | -%} |
37 | | - |
38 | | -{:start="2"} |
39 | | -2. Use a pre-configured Codefresh Dockerfile template from the template selector on the Pipeline view. Navigate to**`Repositories`**→**`Your Repository`**→**`Pipelines`**. |
40 | | - |
41 | | -{% include |
42 | | -image.html |
43 | | -lightbox="true" |
44 | | -file="/images/6b035ff-2016-09-29_13-03-58.png" |
45 | | -url="/images/6b035ff-2016-09-29_13-03-58.png" |
46 | | -alt="2016-09-29_13-03-58.png" |
47 | | -max-width="40%" |
48 | | -%} |
| 10 | + |
| 11 | +You have a[build step]({{site.baseurl}}/docs/codefresh-yaml/steps/build/) in your pipeline that fails with the error message: "Repository does not contain a Dockerfile. Please check the pipeline configuration" or "Failed to fetch the Dockerfile from path" |
| 12 | + |
| 13 | +##Problem description |
| 14 | + |
| 15 | +This error happens when you are trying to build a Docker image and the pipeline step cannot find a Dockerfile. It might be helpful to include a dummy step in your pipeline that prints all files in the workspace. This way you can verify what files are available to the pipeline. |
| 16 | + |
| 17 | +`pipeline step` |
| 18 | +{% highlight yaml %} |
| 19 | +{% raw %} |
| 20 | +print_pwd_files: |
| 21 | + title: 'Listing files' |
| 22 | + image: alpine:latest |
| 23 | + commands: |
| 24 | + - 'ls -l' |
| 25 | +{% endraw %} |
| 26 | +{% endhighlight %} |
| 27 | + |
| 28 | +##The solution |
| 29 | + |
| 30 | +There are two ways to address this error: |
| 31 | + |
| 32 | +First make sure that you have at least one[clone step]({{site.baseurl}}/docs/codefresh-yaml/steps/git-clone/) in your pipeline and that its name is`main_clone`. This way the current folder will automatically be setup in the project folder of the git repository. |
| 33 | + |
| 34 | +`codefresh.yml` |
| 35 | +{% highlight yaml %} |
| 36 | +{% raw %} |
| 37 | +version: '1.0' |
| 38 | +steps: |
| 39 | + main_clone: |
| 40 | + title: 'Cloning main repository...' |
| 41 | + type: git-clone |
| 42 | + repo: kostis-codefresh/example_nodejs_postgres |
| 43 | + revision: master |
| 44 | + git: github |
| 45 | + myDockerImage: |
| 46 | + title: 'Building My Docker Image' |
| 47 | + type: build |
| 48 | + dockerfile: Dockerfile |
| 49 | + image_name: my-app-image |
| 50 | + tag: from-master-branch |
| 51 | +{% endraw %} |
| 52 | +{% endhighlight %} |
| 53 | + |
| 54 | +Secondly, if you checkout multiple git repositories or use another name in your git clone step, make sure that the build step looks at the correct directory: |
| 55 | + |
| 56 | +`codefresh.yml` |
| 57 | +{% highlight yaml %} |
| 58 | +{% raw %} |
| 59 | +version: '1.0' |
| 60 | +steps: |
| 61 | + checkoutApp: |
| 62 | + title: 'Cloning a repository...' |
| 63 | + type: git-clone |
| 64 | + repo: kostis-codefresh/trivial-go-web |
| 65 | + revision: master |
| 66 | + git: github |
| 67 | + myDockerImage: |
| 68 | + title: 'Building Docker Image' |
| 69 | + type: build |
| 70 | + dockerfile: Dockerfile |
| 71 | + working_directory: './trivial-go-web' |
| 72 | + image_name: my-app-image |
| 73 | + tag: from-master-branch |
| 74 | +{% endraw %} |
| 75 | +{% endhighlight %} |
| 76 | + |
| 77 | +Notice the`working_directory` property of the build step that searches for the Dockefile in the folder named`trivial-go-web` instead of the root folder of the pipeline workspace. |
| 78 | + |
| 79 | + |