[Bug]: pull=true
has no effect in Docker Compose Container if version
is not set
#8109
Labels
pull=true
has no effect in Docker Compose Container if version
is not set
#8109
Module
Core
Testcontainers version
1.19.3
Using the latest Testcontainers version?
Yes
Host OS
Windows
Host Arch
x64
Docker version
What happened?
If
pull
is set totrue
in the ComposeContainer/DockerComposeContainer, all images in the docker-compose file should be pulled if they are not available locally. For this purpose, all images returned byparsedComposeFile.getServiceNameToImageNames()
are pulled in the ComposeDelegate. However, if theversion
attribute is not set in the docker-compose file, which is no longer necessary, the map returned byparsedComposeFile.getServiceNameToImageNames()
is empty, so no images are pulled.Cause:
In the ParsedDockerComposeFile, the services are only parsed correctly if the
composeFileContent
contains theversion
key. Otherwise, thecomposeFileContent
is set as theserviceMap
, which results in the service names being interpreted as service definitions.Suggested Fix:
Remove
else
block and limit the upperif
block to the validation of the version only.Relevant log output
No response
Additional Information
Example:
docker-compose.yml:
State of the variables in ParsedDockerComposeFile:93:
The text was updated successfully, but these errors were encountered: