Skip to content

Docker InternalServerErrorException: "archive/tar: cannot encode header: filename may not have trailing slash" #680

Closed

Description

@guillaumesmo

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

Activity

  1. bsideup commented on May 3, 2018

    @bsideup
    Member

    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 :)

  2. guillaumesmo commented on May 3, 2018

    @guillaumesmo
    Author

    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

  3. ryangardner commented on May 7, 2018

    @ryangardner

    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

  4. kiview commented on May 22, 2018

    @kiview
    Member

    Hey @guillaumesmo, is this bug still persistent?

  5. changed the title [-]Unable to start postgres container on docker 18.05.0-ce-rc1-mac63 (24246)[/-] [+]Unable to start postgres container on docker 18.05.0-ce (24246)[/+] on May 25, 2018
  6. changed the title [-]Unable to start postgres container on docker 18.05.0-ce (24246)[/-] [+]Unable to start postgres container on docker 18.05.0-ce[/+] on May 25, 2018
  7. guillaumesmo commented on May 25, 2018

    @guillaumesmo
    Author

    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)
    
  8. self-assigned this
    on May 30, 2018
  9. bsideup commented on May 30, 2018

    @bsideup
    Member

    Hey @ryangardner, did you report it?

  10. mikepii commented on Jul 26, 2018

    @mikepii

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

  11. rnorth commented on Jul 29, 2018

    @rnorth
    Member

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

  12. changed the title [-]Unable to start postgres container on docker 18.05.0-ce[/-] [+]Docker InternalServerErrorException: "archive/tar: cannot encode header: filename may not have trailing slash"[/+] on Jul 29, 2018
  13. added a commit that references this issue on Jul 29, 2018
    5530fad
  14. jamieswogger commented on Jul 30, 2018

    @jamieswogger
    Contributor

    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

  15. SirheiNichyparuk commented on Nov 20, 2018

    @SirheiNichyparuk

    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"}

  16. bsideup commented on Nov 20, 2018

    @bsideup
    Member

    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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions