satackey / action-docker-layer-caching

[CAUTION] This repository is not actively maintained. / Enable Docker layer caching in your GitHub Actions workflow.

Home Page:https://github.com/marketplace/actions/docker-layer-caching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails with docker images pulled by sha

kshpytsya opened this issue · comments

Docker provides a way for referring to images by their SHA hash instead of tags, like this:

$ docker pull pierrezemb/gostatic@sha256:e28d48e17840c5104b5133c30851ac45903b1d2f268d108c4cd0884802c9c87e
$ docker images|grep gostatic
pierrezemb/gostatic                                                              <none>                         4569615e9ed0        2 weeks ago
      7.72MB

Notice the <none> part.

Now, apparently this causes the docker layer caching action to do the equivalent of following under the hood:

$ docker history -q 'pierrezemb/gostatic:<none>'
Error response from daemon: invalid reference format

In the logs of Github build I see:

docker history -q pierrezemb/gostatic:<none>










Error: The process '/usr/bin/docker' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.5/dist/ttsc-dist/post.js/index.js:1300:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.5/dist/ttsc-dist/post.js/index.js:1283:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.5/dist/ttsc-dist/post.js/index.js:1183:27)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
##[error]Error: The process '/usr/bin/docker' failed with exit code 1

I hadn't considered pulling by digest, I'll fix it soon.

Thank you for your report!

I'm getting the same error here:

Post job cleanup.
Error: The process '/usr/bin/docker' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.8/dist/ttsc-dist/post.js/index.js:1300:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.8/dist/ttsc-dist/post.js/index.js:1283:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.8/dist/ttsc-dist/post.js/index.js:1183:27)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
##[error]Error: The process '/usr/bin/docker' failed with exit code 1

https://github.com/mdn/kuma/runs/1063849218

My config can be seen here https://github.com/mdn/kuma/pull/7456/files#diff-12a86cef0c4707531fdbabac3e38cb2aR27 if that helps.
Is it because I'm not specifying a key?

I'm encountering the same issue, any solution for it ?

I'm getting the same error here: [...]
Is it because I'm not specifying a key?

That looks like the same issue as the OP; the kuma_base Dockerfile specifies a source image by digest. That image isn't dangling so the action expects it to have a valid tag instead of <none>.

I'm encountering the same issue, any solution for it ?

Until this issue is resolved I think the only workaround is to specify images by tag instead of by digest.

One thing to also consider is to keep support for specifying the tag AND the hash. This form is common even though the tag here does absolutely nothing, but only helps the reader:

FROM python:3.9.4-slim-buster@sha256:de9482638c1354f5178efc90431de2a42e863a12bf3df41d7fa30d5c10fe543d

One useful trick know is that you don’t have to remove the tag if you want to add a digest. If both are present then the tag is ignored, so you can leave it in for human readability

https://www.whitesourcesoftware.com/free-developer-tools/blog/overcoming-dockers-mutable-image-tags/

One thing to also consider is to keep support for specifying the tag AND the hash.

I've just confirmed that docker does treat that form exactly the same as only specifying the hash. That means that it'll just work when the action supports images specified by hash.

One thing to also consider is to keep support for specifying the tag AND the hash.

I've just confirmed that docker does treat that form exactly the same as only specifying the hash. That means that it'll just work when the action supports images specified by hash.

Yes, to Docker:

FROM python:3.9.4-slim-buster@sha256:de9482638c1354f5178efc90431de2a42e863a12bf3df41d7fa30d5c10fe543d

and

FROM python@sha256:de9482638c1354f5178efc90431de2a42e863a12bf3df41d7fa30d5c10fe543d

are identical. Just wasn't familiar with this Action's internals and wanted to give a heads up about it :)

Any updates on this?
I am getting the same Error: The process '/usr/bin/docker' failed with exit code 1 in the Post Layer Cache step, on the first run, with the following configuration:
code