jkube: Error processing tar file(archive/tar: missed writing 4096 bytes):
Description
The jkube:build goal failes on CentOS Linux release 7.9.2009 (Core) with:
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.3.0:build (default) on project myapp-docker: Failed to execute the build: Error while trying to build the image: Unable to build image [someco/myapp:latest] : {"message":"Error processing tar file(archive/tar: missed writing 4096 bytes): "} (Internal Server Error: 500) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.3.0:build (default) on project myapp-docker: Failed to execute the build
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to execute the build
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.buildAndTag(AbstractDockerMojo.java:665)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.processImageConfig(AbstractDockerMojo.java:503)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.executeBuildGoal(AbstractDockerMojo.java:632)
at org.eclipse.jkube.maven.plugin.mojo.build.BuildMojo.executeInternal(BuildMojo.java:49)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.execute(AbstractDockerMojo.java:444)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.eclipse.jkube.kit.config.service.JKubeServiceException: Error while trying to build the image: Unable to build image [someco/myapp:latest] : {"message":"Error processing tar file(archive/tar: missed writing 4096 bytes): "} (Internal Server Error: 500)
at org.eclipse.jkube.kit.config.service.kubernetes.DockerBuildService.build(DockerBuildService.java:52)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.buildAndTag(AbstractDockerMojo.java:662)
... 26 more
Caused by: org.eclipse.jkube.kit.build.service.docker.access.DockerAccessException: Unable to build image [someco/myapp:latest] : {"message":"Error processing tar file(archive/tar: missed writing 4096 bytes): "} (Internal Server Error: 500)
at org.eclipse.jkube.kit.build.service.docker.access.hc.DockerAccessWithHcClient.buildImage(DockerAccessWithHcClient.java:272)
at org.eclipse.jkube.kit.build.service.docker.BuildService.doBuildImage(BuildService.java:179)
at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:143)
at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:77)
at org.eclipse.jkube.kit.config.service.kubernetes.DockerBuildService.build(DockerBuildService.java:44)
... 27 more
Caused by: org.eclipse.jkube.kit.build.service.docker.access.hc.http.HttpRequestException: {"message":"Error processing tar file(archive/tar: missed writing 4096 bytes): "} (Internal Server Error: 500)
at org.eclipse.jkube.kit.build.service.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse(ApacheHttpClientDelegate.java:200)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
at org.eclipse.jkube.kit.build.service.docker.access.hc.ApacheHttpClientDelegate.post(ApacheHttpClientDelegate.java:121)
at org.eclipse.jkube.kit.build.service.docker.access.hc.DockerAccessWithHcClient.buildImage(DockerAccessWithHcClient.java:270)
... 31 more
The same project is working on Windows.
The TAR file looks fine with tar -tf docker-build.tar.
The image can be built manually by going into the assembly directory and running docker build . so docker and the docker daemon are working.
The TAR file is somehow not valid for the docker daemon:
[root@srv3 tmp]# cat docker-build.tar | docker build -
Sending build context to Docker daemon 212 kB
Error response from daemon: Error processing tar file(archive/tar: missed writin 4096 bytes):
[root@srv3 tmp]#
Info
- Eclipse JKube version : 1.3.0
- Maven version (
mvn -v) : 3.6.3
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 47 (23 by maintainers)
Commits related to this issue
- Fix #777: Failure in processing generated tarball by old Docker versions Tar files generated during `k8s:build` were getting rejected from Docker v1.12.1 (API version 1.24). Not setting size of TarAr... — committed to rohanKanojia/jkube by rohanKanojia 3 years ago
- Fix #777: Failure in processing generated tarball by old Docker versions Tar files generated during `k8s:build` were getting rejected from Docker v1.12.1 (API version 1.24). Not setting size of TarAr... — committed to eclipse/jkube by rohanKanojia 3 years ago
- fix (jkube-kit) : JKubeTarArchiver should always set set TarEntry size to zero for directories (#777) While fixing tarball issue in #793, we had added this `tarEntry.setSize(0L)` in JKubeTarArchiver ... — committed to rohanKanojia/jkube by rohanKanojia 2 years ago
- fix (jkube-kit) : JKubeTarArchiver should always set set TarEntry size to zero for directories (#777) While fixing tarball issue in #793, we had added this `tarEntry.setSize(0L)` in JKubeTarArchiver ... — committed to rohanKanojia/jkube by rohanKanojia 2 years ago
- fix (jkube-kit) : JKubeTarArchiver should always set set TarEntry size to zero for directories (#777) While fixing tarball issue in #793, we had added this `tarEntry.setSize(0L)` in JKubeTarArchiver ... — committed to rohanKanojia/jkube by rohanKanojia 2 years ago
- fix (jkube-kit) : JKubeTarArchiver should always set set TarEntry size to zero for directories (#777) While fixing tarball issue in #793, we had added this `tarEntry.setSize(0L)` in JKubeTarArchiver ... — committed to eclipse/jkube by rohanKanojia 2 years ago
- fix (jkube-kit) : JKubeTarArchiver should always set set TarEntry size to zero for directories (#777) While fixing tarball issue in #793, we had added this `tarEntry.setSize(0L)` in JKubeTarArchiver ... — committed to baruKreddy/jkube by rohanKanojia 2 years ago
(thank you guys and keep up the good work)
I noticed that in case of jkube directory size was more than zero:
When I set TarArchiveEntry size only in case of files, I’m able to get jkube working with docker: https://github.com/eclipse/jkube/blob/15bb59fbe2eb8c5f26e450ec7e4256bae19fe070/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/archive/JKubeTarArchiver.java#L78
I have sketched https://github.com/eclipse/jkube/issues/782
Ye, thats exactly what we see. The docker host seems to reject the tar file or something to that effect… we uave a fair few docker file based projects that need migrating so i would be super appreciative if you could find a solution.
Hi @pmbsa It’s in our sprint plan but haven’t had the chance to investigate yet. We’re currently focused on releasing JKube (yesterday -> 2022-05-24), and Fabric8 Kubernetes Client. 😓
Hi Paul, sorry still no time. I’ll reopen the issue and try to allocate some time for us to investigate.
That gets really hard for me to do, I have to sell my soul to the gods of banking before I am allowed to do stuff like that but I will try. Its worth mentioning though that the structure in the target/docker folder is perfectly formed for the image. If I run “docker build” from the folder that has the generated Dockerfile I am able to build the image perfectly and stand up the container
Using mvn 3.3.9. Splitting phases is not enough if I still call the goals in the following sequence
mvn ... clean package k8s:build deployInstead it works fine - splitting phases or not doesn’t matter - if I simply call them separately, i.e.
mvn ... clean package k8s:buildmvn ... deployThat said the logging issue is not reproducible using a slightly more recent version of maven such as 3.6.3 (trioed that as it is already in use on other CI systems)
If it’s not necessary I’d rather keep it this way. Maybe the unnecessary fix breaks something else. I just added the comment for the record in case we hit some other issue in the future.
@davidecavestro : Thanks a lot for sharing vagrantfile, I can reproduce your issue
I think in FMP we relied on Maven to generate the tar file. We really need to see the difference of a tar file generated with one plugin and the other. With two equivalent configurations (image model), the tar generated from FMP and JKube should be exactly the same.
😦 Could you open a specific feature request issue for that 🙏
Never tried with jib build strategy here. Great idea, I’ll give it a try. Updating Docker is the last resort, as this is an old CI server manually mantained by other folks so far, hence potentially plenty of pitfalls. About commons-compress it would be interesting to compare the tar with one generated by tar cli (maybe I’ll give it a try)
The docker load command fails with
both on the problematic server and in dev local env.
At https://github.com/davidecavestro/vagrant-jkube-connection-reset-by-peer I’ve shared some stuff to reproduce the issue on a vagrant box.