Docker Community Forums

Share and learn in the Docker community.

Run docker build - Cant not found docker file

This is how I try to make use of Github Actions in relation to the project being built in Docker. I have look on this site here: How do I specify the dockerfile location in my github action?

That which I would like out of it. It is that it makes use of the docker File that makes in my project.

I have built like this in relation to my files:
V14zKcv

API

  • Docker (File)

Service

Data

Test

However, it’s the case that my Docker is in the API section.

I have tried this:

name: Docker Image CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build the Docker image
      run: docker build ./API/ --file Dockerfile --tag my-image-name:$(date +%s)

and i have try

docker build . --file Dockerfile --tag my-image-name:$(date +%s)

Error Says: unable to prepare context: unable to evaluate symlinks in Dockerfile path

Try this:

docker build ./API/ --file ./API/Dockerfile --tag my-image-name:$(date +%s)

Dockerfile doe not have to be in the context. Using ./API/ as a context and Dockerfile as file, Docker will look for Dockerfile in the root directory next to ./API/

Nice that I somehow got a little further because it did a lot of things that it has not done before.

However, an error still appears as you can see here in the picture.

Can it help you or need more information?

How could you build it locally? Have you tried it? If you refer the API folder in the Dockerfile that means your context must be outside the API folder. In that case only the Dockerfile should be referred starting with the folder:

docker build . --file API/Dockerfile --tag my-image-name:$(date +%s)

It looks like you tried every combination except the one you needed :smiley:

If it works, then you were close. :slight_smile:

1 Like

Thanks for help!! :slight_smile: