I've set up a kaniko based image build that is set to push against Docker hub. I see errors when kaniko attempts to push layers to the layer cache in Docker hub.
$ docker run -v /Users/cdupuis/.docker/config.json:/root/.docker/config.json -v `pwd`:/workspace gcr.io/kaniko-project/executor:latest --dockerfile Dockerfile --context dir:///workspace/ -d index.docker.io/atomist/demo-sdm:1.0.1-master.20181219100706 --cache=true
With the repo and Dockerfile from https://github.com/atomist-seeds/demo-sdm
Running the command produces the following output:
INFO[0001] Checking for cached layer index.docker.io/atomist/demo-sdm/cache:b47478bd050048adfa939200c5244f4a3594fb20e55c7808095730615f58f694...
INFO[0001] No cached layer found for cmd RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
.... <snip>
INFO[0044] Pushing layer index.docker.io/atomist/demo-sdm/cache:b47478bd050048adfa939200c5244f4a3594fb20e55c7808095730615f58f694 to cache now
....<snip>
WARN[0348] error uploading layer to cache: failed to push to destination index.docker.io/atomist/demo-sdm/cache:b47478bd050048adfa939200c5244f4a3594fb20e55c7808095730615f58f694: unsupported status code 401; body:
2019/01/11 12:47:09 pushed blob sha256:7d644e9620a176dd3021ae3b3a1085c16554ab61cdf0e37da98f3509a6acbaf9
2019/01/11 12:47:09 pushed blob sha256:46a743e3b16c938e00cc3a7b2207134c0edf8f19527f64202085555147d2af9d
2019/01/11 12:47:09 pushed blob sha256:e5e442c4920d53dad151916ae09cce18560c54d2d969ce744142b76b380da3fe
2019/01/11 12:47:09 pushed blob sha256:b383dd2f9dcc4c0e53a397b239e4c52105e26e3ccb9232c0aa171d1bd87a2c67
2019/01/11 12:47:09 pushed blob sha256:250a64c06965057c28bc888c967ee158068347dce164700b2c986d9514fbce66
2019/01/11 12:47:09 pushed blob sha256:093c7b2b349fe17876e86c21fdf731ada1960436b9e8383dd318a873e1402e5e
2019/01/11 12:47:10 pushed blob sha256:fbfc4b4a843334237637cdc0fd23a6470e47aad56e24a1996c20675f293c040e
2019/01/11 12:47:10 pushed blob sha256:cf7ef35c4a6195e3d04c6b9a9521dd5301285a676991be37ff22bcafb3e32af7
2019/01/11 12:47:10 pushed blob sha256:84042c1a51f0d5b59844ef1764992f336ab5d61be7bb8aa5ec0411079d144166
2019/01/11 12:47:11 pushed blob sha256:85b10dc0e32b12abf5922120a440e771a62bb37d230000b9dad4a5e5f89ea727
2019/01/11 12:47:17 pushed blob sha256:b3f5fe1501ed89e5e312afdaa8c65289aa90e35c2e84358720a44413c5284ae1
2019/01/11 12:47:19 pushed blob sha256:e8f7c48148bf270549a4acdf4ee6446afb081f6c57f9f6de9b7c7dfa72ec51b1
2019/01/11 12:47:20 pushed blob sha256:64e9cfe95d8cac0c3236675e712a6d0601e932a25b69f382da8a69b343ce5104
2019/01/11 12:47:27 pushed blob sha256:06a9e628e390a2eb84483c646c6ff4a3386d722336be58062ee4ad132fea499e
2019/01/11 12:47:29 pushed blob sha256:0f2eafba31d31449e0f31ebc17b9fcd326f21fbbee7d14563b882f761eaf5bf9
2019/01/11 12:47:33 pushed blob sha256:a68ad32e782e8e980b0408981bca101c424eafc6922241a0b043b4e9d746cc54
2019/01/11 12:47:33 index.docker.io/atomist/demo-sdm:1.0.1-master.20181219100706: digest: sha256:fce87fd284354ea36a9127b35f344c2543bc487d518ed92b16f01166e44eed4c size: 2709
The image is ultimately pushed successfully and runs fine when pulling from Docker hub.
Subsequent kaniko builds show the same log making me think that the layers are indeed not successfully cached in Docker hub.
As you can see here, Docker Hub repository names are only allowed to have up to 255 characters and can only contain lowercase letters, numbers, or - and _. Sub-Repositories are not allowed on Docker Hub so the image push fails for repo/cache.
I'd suggest specifying the cache repository manually, e.g. --cache-repo atomist/demo-sdm-cache. The repo/cache naming should work on all registries except Docker Hub.
That's great insight. Thanks very much. I'll try that and report back.
@cdupuis did you try it?
Yes, the suggestion works perfect. Thanks.
Most helpful comment
As you can see here, Docker Hub repository names are only allowed to have up to 255 characters and can only contain lowercase letters, numbers, or
-and_. Sub-Repositories are not allowed on Docker Hub so the image push fails forrepo/cache.I'd suggest specifying the cache repository manually, e.g.
--cache-repo atomist/demo-sdm-cache. Therepo/cachenaming should work on all registries except Docker Hub.