Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
guillaumesmo opened this issue May 3, 2018 · 11 comments

Comments

@guillaumesmo
Copy link

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

@bsideup
Copy link
Member

bsideup commented May 3, 2018

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

@guillaumesmo
Copy link
Author

guillaumesmo commented May 3, 2018

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

@ryangardner
Copy link

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

@kiview
Copy link
Member

kiview commented May 22, 2018

Hey @guillaumesmo, is this bug still persistent?

@guillaumesmo guillaumesmo 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) May 25, 2018
@guillaumesmo guillaumesmo 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 May 25, 2018
@guillaumesmo
Copy link
Author

guillaumesmo commented May 25, 2018

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)

@bsideup
Copy link
Member

bsideup commented May 30, 2018

Hey @ryangardner, did you report it?

@mikepii
Copy link

mikepii commented Jul 26, 2018

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

@rnorth
Copy link
Member

rnorth commented Jul 29, 2018

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

@rnorth rnorth 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" Jul 29, 2018
rnorth added a commit that referenced this issue Jul 29, 2018
@rnorth rnorth closed this as completed in 3593c12 Jul 30, 2018
@jamieswogger
Copy link
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

@SirheiNichyparuk
Copy link

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

@bsideup
Copy link
Member

bsideup commented Nov 20, 2018

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
Projects
None yet
Development

No branches or pull requests

8 participants