Cannot write output in Github action from Docker
Closed this issue · 3 comments
simonwfarrow commented
Hi,
I am trying to execute your docker image in a Github workflow.
I see the following error :
Exception in thread "main" java.io.FileNotFoundException: docs/index.html (Permission denied)
I believe this is caused by setting the USER property in the Docker file :
USER generatr
As outlined here - https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#docker-container-filesystem
The full command the workflow runs is :
docker run -t --rm -v /runner/_work/electronic-architect/electronic-architect:/var/model ghcr.io/avisi-cloud/structurizr-site-generatr generate-site -w resources/ecom/dsl/ecom.dsl -o docs
And my workflow action is:
- name: Run docker image to create diagrams and markdown
run: |
docker run -t --rm -v ${{ github.workspace }}:/var/model ghcr.io/avisi-cloud/structurizr-site-generatr generate-site -w resources/ecom/dsl/ecom.dsl -o docs
qtzar commented
if you add --user root
to the docker command then it will run correctly with GitHub Actions. There is an example of the Github Action code that I'm using in the discussions section.
simonwfarrow commented
Excellent, thank you for the speedy response, that works just fine 👍
simonwfarrow commented
Solved - see this discussion