Thursday, 21 May 2020

Docker and Node and macOS - Computer Said No

I'm using a Docker container that runs a NodeJS application to lint-check YAML files relating to my new best friend, Tekton CD.

This container is run as follows: -

docker run --volume $(PWD):/foo --rm --interactive tekton-lint /foo/sbs_pipeline.yaml

and should check the YAML for errors such as this: -

Error: Pipeline 'pipeline' references task 'build-task' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.

Sadly, however, when I ran the container, I saw: -

[Error: EPERM: operation not permitted, open '/foo/foo.yaml'] {

Something told me that this MAY be related to the path of the file that I was checking ....

Note that the container uses Docker volumes, via the --volume switch, mapping FROM $(PWD) on the host TO /foo inside the container.

Therefore, I wondered whether the problem was with the FROM path, which was a GitHub repository cloned locally on my Mac.

Well, I was close .......

For no particular reason, I've chosen to clone GH repositories to a subdirectory of my ~/Documents folder: -

/Users/hayd/Documents/GitHub/....

Can you see where I might be going wrong ??

Yep, macOS is protecting me from myself, by disallowing Docker from full access to my Documents folder ......


Once I changed this: -


and restarted Docker .....

All was well 👍🏽



No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...