You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Client:
Version: 27.4.0
API version: 1.47
Go version: go1.22.10
Git commit: bde2b89
Built: Sat Dec 7 10:35:43 2024
OS/Arch: darwin/amd64
Context: desktop-linux
Server: Docker Desktop 4.37.2 (179585)
Engine:
Version: 27.4.0
API version: 1.47 (minimum version 1.24)
Go version: go1.22.10
Git commit: 92a8393
Built: Sat Dec 7 10:38:57 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.21
GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111
runc:
Version: 1.1.13
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
What happened?
When using the DockerComposeContainer to execute a test where the process in the container is running indefinitely and writing to a mounted folder I get an IOException because of unexpected EOF.
The setup is the following:
Docker image with an entrypoint that forever appends a string to a file.
Docker compose file that mounts the folder of the file to a host path
The test code simply starts and stops the container.
If I create the folder from the test and then start the container it seems to work, but I haven't noticed different permissions on the folder or the file.
If the process stops before the container stops the error doesn't occur.
If I don't mount the folder to a host path the error doesn't occur.
I'm attaching a test project were I replicated the above. In our actual work scenario we are running in the container a service which modifies a database and a logs folder both of which are mounted. I got around the issue by killing the process before stoping the docker compose container.
Relevant log output
------Running working Docker compose------
Image pull policy will be performed by: DefaultPullPolicy()
Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
Testcontainers version: 1.20.4
Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
Docker host IP address is localhost
Connected to docker:
Server Version: 27.4.0
API Version: 1.47
Operating System: Docker Desktop
Total Memory: 7837 MB
Labels:
com.docker.desktop.address=unix:///Users/stefanos/Library/Containers/com.docker.docker/Data/docker-cli.sock
Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
Checking the system...
✔︎ Docker server version should be at least 1.6.0
Creating container for image: testcontainers/ryuk:0.11.0
Container testcontainers/ryuk:0.11.0 is starting: 2e22d00fe6125a679449b8f0e22d38af3ec0c7e600fc283431e22ffc7e2ec8e7
Container testcontainers/ryuk:0.11.0 started in PT0.462883S
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: 9848a5107663811fbdb6d1b73a975e8749f6350b3340a9eaedb4f31737257c71
Container docker/compose:1.29.2 started in PT2.567399S
Docker Compose container is running for command: up -d
STDERR: Creating network "7uhtlqvezyq2_default" with the default driver
STDERR: Building secretscontainer
STDERR: #1 [internal] load build definition from Dockerfile-working
STDERR: #1 transferring dockerfile: 254B done
STDERR: #1 DONE 0.0s
STDERR:
STDERR: #2 [internal] load metadata for docker.io/redhat/ubi9-minimal:latest
STDERR: #2 DONE 0.4s
STDERR:
STDERR: #3 [internal] load .dockerignore
STDERR: #3 transferring context: 2B done
STDERR: #3 DONE 0.1s
STDERR:
STDERR: #7 [1/3] FROM docker.io/redhat/ubi9-minimal:latest@sha256:b87097994ed62fbf1...
STDERR: #7 DONE 0.0s
STDERR:
STDERR: #6 [internal] load build context
STDERR: #6 transferring context: 112B done
STDERR: #6 DONE 0.0s
STDERR:
STDERR: #5 [2/3] COPY docker-entrypoint-working.sh /startup/docker-entrypoint-worki...
STDERR: #5 CACHED
STDERR:
STDERR: #4 [3/3] RUN chmod -R 777 /startup
STDERR: #4 CACHED
STDERR:
STDERR: #8 exporting to image
STDERR: #8 exporting layers done
STDERR: #8 writing image sha256:7d3a26f6a91cf1492a00fe2f38af4e35fd53fcb3b2437e8a5a486b8a6765fc66 done
STDERR: #8 naming to docker.io/library/7uhtlqvezyq2_secretscontainer:latest done
STDERR: #8 DONE 0.0s
STDERR: Image for service secretscontainer was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
STDERR: Creating 7uhtlqvezyq2_secretscontainer_1 ...
STDERR: Creating 7uhtlqvezyq2_secretscontainer_1 ... done
Docker Compose has finished running
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: 853ad2c6724aa73f9d021bb00ff8ee8feaa6dcfc21de56513e06604e4e5b7814
Container docker/compose:1.29.2 started in PT1.251008S
Docker Compose container is running for command: down -v
STDERR: Removing 7uhtlqvezyq2_secretscontainer_1 ...
STDERR: Removing 7uhtlqvezyq2_secretscontainer_1 ... done
STDERR: Removing network 7uhtlqvezyq2_default
Docker Compose has finished running
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: 4f10545e643ba895605903fca7f8ee361488ed8980b1fd00d90868e761a866dd
Container docker/compose:1.29.2 started in PT1.15881S
Docker Compose container is running for command: down -v
STDERR: Removing network 7uhtlqvezyq2_default
STDERR: Network 7uhtlqvezyq2_default not found.
Docker Compose has finished running
------Running working Docker compose 2------
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: eaa5c8449cb8368b03adf2a5c6fbd10072e29c5fa1ce45057121118fc74167fd
Container docker/compose:1.29.2 started in PT1.852965S
Docker Compose container is running for command: up -d
STDERR: Creating network "evxxmyhlartk_default" with the default driver
STDERR: Building secretscontainer
STDERR: #1 [internal] load build definition from Dockerfile
STDERR: #1 transferring dockerfile: 222B done
STDERR: #1 DONE 0.0s
STDERR:
STDERR: #2 [internal] load metadata for docker.io/redhat/ubi9-minimal:latest
STDERR: #2 DONE 0.2s
STDERR:
STDERR: #3 [internal] load .dockerignore
STDERR: #3 transferring context: 2B done
STDERR: #3 DONE 0.0s
STDERR:
STDERR: #7 [1/3] FROM docker.io/redhat/ubi9-minimal:latest@sha256:b87097994ed62fbf1...
STDERR: #7 DONE 0.0s
STDERR:
STDERR: #6 [internal] load build context
STDERR: #6 transferring context: 131B done
STDERR: #6 DONE 0.0s
STDERR:
STDERR: #5 [2/3] COPY docker-entrypoint.sh /startup/docker-entrypoint.sh
STDERR: #5 CACHED
STDERR:
STDERR: #4 [3/3] RUN chmod -R 777 /startup
STDERR: #4 CACHED
STDERR:
STDERR: #8 exporting to image
STDERR: #8 exporting layers done
STDERR: #8 writing image sha256:a08a6e5d6cce9f3704ff581f056267718ef90106bf024149f2babac6bed1c73c done
STDERR: #8 naming to docker.io/library/evxxmyhlartk_secretscontainer:latest done
STDERR: #8 DONE 0.0s
STDERR: Image for service secretscontainer was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
STDERR: Creating evxxmyhlartk_secretscontainer_1 ...
STDERR: Creating evxxmyhlartk_secretscontainer_1 ... done
Docker Compose has finished running
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: 4bbd1d3789069ee72c02e835bbbdfb8885dc295bf5b8cb59cdcc3633ddb4ce61
Container docker/compose:1.29.2 started in PT11.600875S
Docker Compose container is running for command: down -v
STDERR: Stopping evxxmyhlartk_secretscontainer_1 ...
STDERR: Stopping evxxmyhlartk_secretscontainer_1 ... done
STDERR: Removing evxxmyhlartk_secretscontainer_1 ...
STDERR: Removing evxxmyhlartk_secretscontainer_1 ... done
STDERR: Removing network evxxmyhlartk_default
Docker Compose has finished running
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: f6d72074c97c6007940ecb95aab2eea3993404bd4c443754fa19831a49305550
Container docker/compose:1.29.2 started in PT1.155904S
Docker Compose container is running for command: down -v
STDERR: Removing network evxxmyhlartk_default
STDERR: Network evxxmyhlartk_default not found.
Docker Compose has finished running
------Running failing Docker compose------
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Container docker/compose:1.29.2 is starting: b89734a078dd1fc4c8cc55ad5d28115eb66f21fc53013963518a3170656e0e11
Container docker/compose:1.29.2 started in PT2.363945S
Docker Compose container is running for command: up -d
STDERR: Creating network "mskyh8nzr8og_default" with the default driver
STDERR: Building secretscontainer
STDERR: #1 [internal] load build definition from Dockerfile
STDERR: #1 DONE 0.0s
STDERR:
STDERR: #1 [internal] load build definition from Dockerfile
STDERR: #1 transferring dockerfile: 222B done
STDERR: #1 DONE 0.0s
STDERR:
STDERR: #2 [internal] load metadata for docker.io/redhat/ubi9-minimal:latest
STDERR: #2 DONE 0.4s
STDERR:
STDERR: #3 [internal] load .dockerignore
STDERR: #3 transferring context: 2B done
STDERR: #3 DONE 0.0s
STDERR:
STDERR: #7 [1/3] FROM docker.io/redhat/ubi9-minimal:latest@sha256:b87097994ed62fbf1...
STDERR: #7 DONE 0.0s
STDERR:
STDERR: #6 [internal] load build context
STDERR: #6 transferring context: 131B done
STDERR: #6 DONE 0.0s
STDERR:
STDERR: #5 [2/3] COPY docker-entrypoint.sh /startup/docker-entrypoint.sh
STDERR: #5 CACHED
STDERR:
STDERR: #4 [3/3] RUN chmod -R 777 /startup
STDERR: #4 CACHED
STDERR:
STDERR: #8 exporting to image
STDERR: #8 exporting layers done
STDERR: #8 writing image sha256:a08a6e5d6cce9f3704ff581f056267718ef90106bf024149f2babac6bed1c73c done
STDERR: #8 naming to docker.io/library/mskyh8nzr8og_secretscontainer:latest done
STDERR: #8 DONE 0.0s
STDERR: Image for service secretscontainer was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
STDERR: Creating mskyh8nzr8og_secretscontainer_1 ...
STDERR: Creating mskyh8nzr8og_secretscontainer_1 ... done
Docker Compose has finished running
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Error when copying TAR file entry: /Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log
java.io.IOException: Request to write '7792' bytes exceeds size in header of '97888' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:715)
at java.base/java.io.InputStream.transferTo(InputStream.java:783)
at java.base/java.nio.file.Files.copy(Files.java:3213)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:362)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.transferTo(MountableFile.java:327)
at org.testcontainers.containers.ContainerState.lambda$copyFileToContainer$2(ContainerState.java:358)
at java.base/java.lang.Thread.run(Thread.java:833)
Could not start container
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"unexpected EOF"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.put(DefaultInvocationBuilder.java:223)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:34)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:13)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
at org.testcontainers.shaded.com.github.dockerjava.core.command.CopyArchiveToContainerCmdImpl.exec(CopyArchiveToContainerCmdImpl.java:162)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:370)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:331)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:433)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:346)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:336)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(ContainerisedDockerCompose.java:84)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:241)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:178)
at org.example.Main.failingSetup(Main.java:77)
at org.example.Main.main(Main.java:22)
Suppressed: java.io.IOException: This archive contains unclosed entries.
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:452)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:322)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:373)
... 12 more
Exception in thread "Thread-11" java.io.UncheckedIOException: java.io.IOException: Request to write '7792' bytes exceeds size in header of '97888' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:381)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.transferTo(MountableFile.java:327)
at org.testcontainers.containers.ContainerState.lambda$copyFileToContainer$2(ContainerState.java:358)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Request to write '7792' bytes exceeds size in header of '97888' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:715)
at java.base/java.io.InputStream.transferTo(InputStream.java:783)
at java.base/java.nio.file.Files.copy(Files.java:3213)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:362)
... 5 more
There are no stdout/stderr logs available for the failed container
Copying all files in /Users/stefanos/Repos/DockerComposeError/target/classes into the container
Creating container for image: docker/compose:1.29.2
Error when copying TAR file entry: /Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log
java.io.IOException: Request to write '8192' bytes exceeds size in header of '98288' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:715)
at java.base/java.io.InputStream.transferTo(InputStream.java:783)
at java.base/java.nio.file.Files.copy(Files.java:3213)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:362)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.transferTo(MountableFile.java:327)
at org.testcontainers.containers.ContainerState.lambda$copyFileToContainer$2(ContainerState.java:358)
at java.base/java.lang.Thread.run(Thread.java:833)
Could not start container
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"unexpected EOF"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.put(DefaultInvocationBuilder.java:223)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:34)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:13)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
at org.testcontainers.shaded.com.github.dockerjava.core.command.CopyArchiveToContainerCmdImpl.exec(CopyArchiveToContainerCmdImpl.java:162)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:370)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:331)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:433)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:346)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:336)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(ContainerisedDockerCompose.java:84)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:241)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:178)
at org.testcontainers.lifecycle.Startable.close(Startable.java:17)
at org.example.Main.failingSetup(Main.java:71)
at org.example.Main.main(Main.java:22)
Suppressed: java.io.IOException: This archive contains unclosed entries.
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:452)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:322)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:373)
... 13 more
There are no stdout/stderr logs available for the failed container
Exception in thread "Thread-12" java.io.UncheckedIOException: java.io.IOException: Request to write '8192' bytes exceeds size in header of '98288' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:381)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:371)
at org.testcontainers.utility.MountableFile.transferTo(MountableFile.java:327)
at org.testcontainers.containers.ContainerState.lambda$copyFileToContainer$2(ContainerState.java:358)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Request to write '8192' bytes exceeds size in header of '98288' bytes for entry 'Users/stefanos/Repos/DockerComposeError/target/classes/testdata/test.log'
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:715)
at java.base/java.io.InputStream.transferTo(InputStream.java:783)
at java.base/java.nio.file.Files.copy(Files.java:3213)
at org.testcontainers.utility.MountableFile.recursiveTar(MountableFile.java:362)
... 5 more
Exception in thread "main" org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker/compose:1.29.2
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:351)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(ContainerisedDockerCompose.java:84)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:241)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:178)
at org.example.Main.failingSetup(Main.java:77)
at org.example.Main.main(Main.java:22)
Suppressed: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker/compose:1.29.2
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:351)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(ContainerisedDockerCompose.java:84)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:241)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:178)
at org.testcontainers.lifecycle.Startable.close(Startable.java:17)
at org.example.Main.failingSetup(Main.java:71)
... 1 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:336)
... 7 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:556)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:346)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 8 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"unexpected EOF"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.put(DefaultInvocationBuilder.java:223)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:34)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:13)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
at org.testcontainers.shaded.com.github.dockerjava.core.command.CopyArchiveToContainerCmdImpl.exec(CopyArchiveToContainerCmdImpl.java:162)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:370)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:331)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:433)
... 10 more
Suppressed: java.io.IOException: This archive contains unclosed entries.
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:452)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:322)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:373)
... 13 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:336)
... 6 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:556)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:346)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 7 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"unexpected EOF"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.put(DefaultInvocationBuilder.java:223)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:34)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.CopyArchiveToContainerCmdExec.execute(CopyArchiveToContainerCmdExec.java:13)
at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
at org.testcontainers.shaded.com.github.dockerjava.core.command.CopyArchiveToContainerCmdImpl.exec(CopyArchiveToContainerCmdImpl.java:162)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:370)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:331)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:433)
... 9 more
Suppressed: java.io.IOException: This archive contains unclosed entries.
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:452)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:322)
at org.testcontainers.containers.ContainerState.copyFileToContainer(ContainerState.java:373)
... 12 more
Process finished with exit code 1
Module
Core
Testcontainers version
1.20.4
Using the latest Testcontainers version?
Yes
Host OS
Mac
Host Arch
x64
Docker version
Client: Version: 27.4.0 API version: 1.47 Go version: go1.22.10 Git commit: bde2b89 Built: Sat Dec 7 10:35:43 2024 OS/Arch: darwin/amd64 Context: desktop-linux Server: Docker Desktop 4.37.2 (179585) Engine: Version: 27.4.0 API version: 1.47 (minimum version 1.24) Go version: go1.22.10 Git commit: 92a8393 Built: Sat Dec 7 10:38:57 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.21 GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
What happened?
When using the
DockerComposeContainer
to execute a test where the process in the container is running indefinitely and writing to a mounted folder I get an IOException because of unexpected EOF.The setup is the following:
Docker image with an entrypoint that forever appends a string to a file.
Docker compose file that mounts the folder of the file to a host path
The test code simply starts and stops the container.
If I create the folder from the test and then start the container it seems to work, but I haven't noticed different permissions on the folder or the file.
If the process stops before the container stops the error doesn't occur.
If I don't mount the folder to a host path the error doesn't occur.
I'm attaching a test project were I replicated the above. In our actual work scenario we are running in the container a service which modifies a database and a logs folder both of which are mounted. I got around the issue by killing the process before stoping the docker compose container.
Relevant log output
Additional Information
DockerComposeError.zip
The text was updated successfully, but these errors were encountered: