Testcontainers-java: Docker InternalServerErrorException: "archive/tar: cannot encode header: filename may not have trailing slash"

Created on 3 May 2018  Â·  11Comments  Â·  Source: testcontainers/testcontainers-java

com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"archive/tar: cannot encode header: filename may not have trailing slash"}

Switching to docker stable channel fixed the issue, not sure if this is a docker bug or an incompatibility with the latest version

resolutioawaiting-release

Most helpful comment

I had a similar issue - I updated to 18.05.0-ce-rc1-mac63 (24246) and then my previously-working tests started returning:

com.github.dockerjava.api.exception.DockerClientException: Could not pull image: Network timed out while trying to connect to https://index.docker.io/v1/repositories/bsideup/moby-ryuk/images. You may want to check your internet connection or if you are behind a proxy.

I'm not sure how helpful it will be, but I'm going to open an issue with docker to let them know about this issue with the rc1

All 11 comments

Hi @guillaumesmo!

Oh wow, I hope that's a bug in rc1 o_O Did you report it to Moby project as well? I'm sure they will be happy to know about it :)

Just for further clarification, I'm using the

PostgreSQLContainer(new ImageFromDockerfile(...).withFileFromClasspath(...).get())
````
constructor with the following Dockerfile

FROM postgres:9.6
RUN apt-get update && apt-get -y install postgresql-plperl-9.6
```

and no, I didn't report anything else as I'm not sure where the actual issue lies. I'm using the edge channel for a long time and the issue seems to have started when I got the last update a few days ago

I had a similar issue - I updated to 18.05.0-ce-rc1-mac63 (24246) and then my previously-working tests started returning:

com.github.dockerjava.api.exception.DockerClientException: Could not pull image: Network timed out while trying to connect to https://index.docker.io/v1/repositories/bsideup/moby-ryuk/images. You may want to check your internet connection or if you are behind a proxy.

I'm not sure how helpful it will be, but I'm going to open an issue with docker to let them know about this issue with the rc1

Hey @guillaumesmo, is this bug still persistent?

The issue still exists in the latest edge release (Version 18.05.0-ce-mac66 (24545))

13:11:11.423 [main] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
13:11:11.942 [main] INFO  org.testcontainers.dockerclient.UnixSocketClientProviderStrategy - Accessing docker with local Unix socket
13:11:11.942 [main] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
13:11:11.943 [main] INFO  org.testcontainers.DockerClientFactory - Docker host IP address is localhost
13:11:12.087 [main] INFO  org.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 18.05.0-ce
  API Version: 1.37
  Operating System: Docker for Mac
  Total Memory: 1998 MB
13:11:16.301 [main] INFO  org.testcontainers.DockerClientFactory - Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
        ℹ︎ Checking the system...
        ✔ Docker version should be at least 1.6.0
        ✔ Docker environment should have more than 2GB free disk space
        ✔ File should be mountable
13:11:16.730 [testcontainers-netty-1-12] ERROR com.github.dockerjava.core.async.ResultCallbackTemplate - Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"archive/tar: cannot encode header: filename may not have trailing slash"}
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:109)
    at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33)
    at org.testcontainers.shaded.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at org.testcontainers.shaded.io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at org.testcontainers.shaded.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
    at org.testcontainers.shaded.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
    at org.testcontainers.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
    at org.testcontainers.shaded.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at org.testcontainers.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1342)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at org.testcontainers.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at org.testcontainers.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:934)
    at org.testcontainers.shaded.io.netty.channel.kqueue.AbstractKQueueStreamChannel$KQueueStreamUnsafe.readReady(AbstractKQueueStreamChannel.java:593)
    at org.testcontainers.shaded.io.netty.channel.kqueue.KQueueDomainSocketChannel$KQueueDomainUnsafe.readReady(KQueueDomainSocketChannel.java:131)
    at org.testcontainers.shaded.io.netty.channel.kqueue.AbstractKQueueChannel$AbstractKQueueUnsafe.readReady(AbstractKQueueChannel.java:367)
    at org.testcontainers.shaded.io.netty.channel.kqueue.KQueueEventLoop.processReady(KQueueEventLoop.java:198)
    at org.testcontainers.shaded.io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:270)
    at org.testcontainers.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
    at org.testcontainers.shaded.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
    at java.lang.Thread.run(Thread.java:745)

Hey @ryangardner, did you report it?

I ran into this issue too but unlike @guillaumesmo I'm on the stable Docker channel already (and Docker 18.06.0-ce)

We seems to be seeing this consistently with Docker 18.06.0-ce. Looking into it.

I'm running on docker 18.06.0 and ran into a similar issue:

3489 [testcontainers-netty-1-11] ERROR com.github.dockerjava.core.async.ResultCallbackTemplate  - Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"Error processing tar file(exit status 1): unexpected EOF"}

Just noting that Fix 680 also solves this issue

Hi,
We still see this error.

testcontainers version is 1.5.1
Docker version 18.03.0-ce, build 0520e24302

Do you have any common solution for that?

Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image name from org.testcontainers.images.builder.ImageFromDockerfile@6eee2740
at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:827)
at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:298)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:188)
... 39 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"archive/tar: cannot encode header: filename may not have trailing slash"}

Hi @SirheiNichyparuk,

Well, I would say that the common solution for that is to keep your dependencies up-to-date :)
You're using Testcontainers 1.5.1 and it is 1 year old (note "288 commits to master since this release" ;) ):
https://github.com/testcontainers/testcontainers-java/releases/tag/1.5.1

Try 1.10.1 (latest), and the issue will be gone :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naderghanbari picture naderghanbari  Â·  3Comments

richard77 picture richard77  Â·  3Comments

michael-simons picture michael-simons  Â·  3Comments

aruizca picture aruizca  Â·  4Comments

dabraham02124 picture dabraham02124  Â·  3Comments