DEV Community

Rob Bos
Rob Bos

Posted on • Originally published at devopsjournal.io on

GitHub Actions Create: Dockerfile symlinks error

I was building a new GitHub Action today with a Dockerfile and got a strange error… `unable to prepare context: path “/action” not found.

GitHub execution error message

I was using a Dockerfile in a sub directory, but the documentation indicates this is supported. So, what gives? Is it a mix-up of the file path? I’m testing it on Windows and can build the Dockerfile itself just fine 🤔. Tested with a backslash instead of a slash, but still an error:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /path/to/Dockerfile

GitHub execution error message with symlinks

The fix

On a hunch (this has happened before!), I changed the file ending of the Dockerfile from CRLF into LF (created the file on Windows of-course!) and… 🎉.

Working result with a successful Docker build

For future reference

  1. Check the line endings on your Dockerfile!
  2. You can run an image in your GitHub Action in a subdirectory by using the correct path to it. It needs to be relative to the action.yml file!

`

action.yml

name: 'Octogotchi'
description: 'Octogotchi'
branding:
icon : alert-circle
color: blue
runs:
using: 'docker'
image: 'action/Dockerfile'

`

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay