Docker Compose step is not able to register TEAMCITY_DOCKER_NETWORK on agents
Hello,
Recently we have been trying to transfrom our CI build into a dockerized one.
First of our build steps is a docker-compose which should run all services necessary for the integration tests.
However there is a problem that this step is not able to register TEAMCITY_DOCKER_NETWORK properly, so another step using the Docker wrapper is not able to communicate to running services.
Output of the docker compose step is as below:
[09:23:26]Step 10/11: Docker Compose (13s)
[09:23:27][Step 10/11] Starting docker-compose for Source\PartexBusinessWebsite\docker-compose.integration-tests.services.yml
[09:23:27][Step 10/11] Starting: cmd.exe /c "docker-compose -f "Source\PartexBusinessWebsite\docker-compose.integration-tests.services.yml" up -d"
[09:23:27][Step 10/11] in directory: C:\BuildAgent\work\8935f0a27ef6403c
[09:23:29][Step 10/11] Creating network "partexbusinesswebsite_cinetwork" with the default driver
[09:23:29][Step 10/11] Creating partexbusinesswebsite_elasticsearch_1 ...
[09:23:29][Step 10/11]
[09:23:29][Step 10/11] Creating partexbusinesswebsite_mongo_1 ...
[09:23:29][Step 10/11]
[09:23:29][Step 10/11] Creating partexbusinesswebsite_mailhog_1 ...
[09:23:29][Step 10/11]
[09:23:29][Step 10/11] Docker event: {"status":"create","id":"35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92","from":"elasticsearch:6.2.3","Type":"container","Action":"create","Actor":{"ID":"35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92","Attributes":{"com.docker.compose.config-hash":"925b65c24cb7d1d0f71c5b83efd67b4daaa355bb4e62d3eea7c2bc527b888b59","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"elasticsearch","com.docker.compose.version":"1.23.2","image":"elasticsearch:6.2.3","license":"Elastic License","name":"partexbusinesswebsite_elasticsearch_1","org.label-schema.name":"elasticsearch","org.label-schema.schema-version":"1.0","org.label-schema.url":"https://www.elastic.co/products/elasticsearch","org.label-schema.vcs-url":"https://github.com/elastic/elasticsearch-docker","org.label-schema.vendor":"Elastic","org.label-schema.version":"6.3.2"}},"scope":"local","time":1548404609,"timeNano":1548404609787861500}
[09:23:29][Step 10/11] Create docker info file: C:\BuildAgent\temp\buildTmp\.teamcity\docker\build_1001\events.json
[09:23:30][Step 10/11] Docker event: {"status":"create","id":"f424b202ba57f55fdf25e0bb64f4ed6ed255008a78b0f4242655301c4c873f6b","from":"mongo:4.0.5","Type":"container","Action":"create","Actor":{"ID":"f424b202ba57f55fdf25e0bb64f4ed6ed255008a78b0f4242655301c4c873f6b","Attributes":{"com.docker.compose.config-hash":"fab3bc1fa501391718bce90c1083cc3edba8707b91cb964b6dde76219a9be2f2","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"mongo","com.docker.compose.version":"1.23.2","image":"mongo:4.0.5","name":"partexbusinesswebsite_mongo_1"}},"scope":"local","time":1548404610,"timeNano":1548404610197073600}
[09:23:30][Step 10/11] Docker event: {"status":"create","id":"d61cccfdb391c192a0dee6026c49127bc45605e7b30d451568ea2a38703cb291","from":"mailhog/mailhog","Type":"container","Action":"create","Actor":{"ID":"d61cccfdb391c192a0dee6026c49127bc45605e7b30d451568ea2a38703cb291","Attributes":{"com.docker.compose.config-hash":"3b04d9a96e3043638935c2f278ec3671760c7f0572d9067120fe803e9cff3bea","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"mailhog","com.docker.compose.version":"1.23.2","image":"mailhog/mailhog","name":"partexbusinesswebsite_mailhog_1"}},"scope":"local","time":1548404610,"timeNano":1548404610238800900}
[09:23:32][Step 10/11] Docker event: {"status":"start","id":"d61cccfdb391c192a0dee6026c49127bc45605e7b30d451568ea2a38703cb291","from":"mailhog/mailhog","Type":"container","Action":"start","Actor":{"ID":"d61cccfdb391c192a0dee6026c49127bc45605e7b30d451568ea2a38703cb291","Attributes":{"com.docker.compose.config-hash":"3b04d9a96e3043638935c2f278ec3671760c7f0572d9067120fe803e9cff3bea","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"mailhog","com.docker.compose.version":"1.23.2","image":"mailhog/mailhog","name":"partexbusinesswebsite_mailhog_1"}},"scope":"local","time":1548404612,"timeNano":1548404612486146500}
[09:23:32][Step 10/11] [1A [2K
[09:23:32][Step 10/11] Creating partexbusinesswebsite_mailhog_1 ... done
[09:23:32][Step 10/11] Docker event: {"status":"start","id":"35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92","from":"elasticsearch:6.2.3","Type":"container","Action":"start","Actor":{"ID":"35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92","Attributes":{"com.docker.compose.config-hash":"925b65c24cb7d1d0f71c5b83efd67b4daaa355bb4e62d3eea7c2bc527b888b59","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"elasticsearch","com.docker.compose.version":"1.23.2","image":"elasticsearch:6.2.3","license":"Elastic License","name":"partexbusinesswebsite_elasticsearch_1","org.label-schema.name":"elasticsearch","org.label-schema.schema-version":"1.0","org.label-schema.url":"https://www.elastic.co/products/elasticsearch","org.label-schema.vcs-url":"https://github.com/elastic/elasticsearch-docker","org.label-schema.vendor":"Elastic","org.label-schema.version":"6.3.2"}},"scope":"local","time":1548404612,"timeNano":1548404612568334000}
[09:23:32][Step 10/11] Docker event: {"status":"start","id":"f424b202ba57f55fdf25e0bb64f4ed6ed255008a78b0f4242655301c4c873f6b","from":"mongo:4.0.5","Type":"container","Action":"start","Actor":{"ID":"f424b202ba57f55fdf25e0bb64f4ed6ed255008a78b0f4242655301c4c873f6b","Attributes":{"com.docker.compose.config-hash":"fab3bc1fa501391718bce90c1083cc3edba8707b91cb964b6dde76219a9be2f2","com.docker.compose.container-number":"1","com.docker.compose.oneoff":"False","com.docker.compose.project":"partexbusinesswebsite","com.docker.compose.service":"mongo","com.docker.compose.version":"1.23.2","image":"mongo:4.0.5","name":"partexbusinesswebsite_mongo_1"}},"scope":"local","time":1548404612,"timeNano":1548404612628980800}
[09:23:32][Step 10/11] [1B [3A [2K
[09:23:32][Step 10/11] Creating partexbusinesswebsite_elasticsearch_1 ... done
[09:23:32][Step 10/11] [3B [2A [2K
[09:23:32][Step 10/11] Creating partexbusinesswebsite_mongo_1 ... done
[09:23:32][Step 10/11] [2B
[09:23:32][Step 10/11] Process exited with code 0
[09:23:34][Step 10/11] Run: docker inspect 35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92 --format="{{ .State.Health.Status }} {{ .Name }}"
[09:23:34][Step 10/11] Template parsing error: template: :1:9: executing "" at <.State.Health.Status>: map has no entry for key "Health"
[09:23:34][Step 10/11] Run: docker inspect d61cccfdb391c192a0dee6026c49127bc45605e7b30d451568ea2a38703cb291 --format="{{ .State.Health.Status }} {{ .Name }}"
[09:23:34][Step 10/11] Template parsing error: template: :1:9: executing "" at <.State.Health.Status>: map has no entry for key "Health"
[09:23:34][Step 10/11] Run: docker inspect f424b202ba57f55fdf25e0bb64f4ed6ed255008a78b0f4242655301c4c873f6b --format="{{ .State.Health.Status }} {{ .Name }}"
[09:23:34][Step 10/11] Template parsing error: template: :1:9: executing "" at <.State.Health.Status>: map has no entry for key "Health"
[09:23:36][Step 10/11] Run: docker inspect 35cc799bddf35ca6d9fe2125cccc9d5d33809f4328b49d0e588e93f39f99df92 --format "{{range \$n,\$conf := .NetworkSettings.Networks}}{{\$n}} {{end}}"
[09:23:39][Step 10/11] Template parsing error: template: :1: unexpected "\\" in range
[09:23:39][Step 10/11] Registering environment variable TEAMCITY_DOCKER_NETWORK=
As far as I undestand last 3 lines correctly it seams that docker inspect is called with improper --format value. I've checked and running this command in powershell also gives same Template parsin error message. I think the correct form is --format '{{range $n, $conf := .NetworkSettings.Networks}}{{$n}} {{end}}'
The agents are running on Windows 10 PC's and they are installed using the standard installer (not dockerized).
Can you please tell me how to handle this issue?
Thanks!
Please sign in to leave a comment.
Hello,
A workaround for the problem is to patch docker-support.zip plugin from TeamCity/webapps/ROOT/WEB-INF/docker-support.zip and place the patched version into TeamCityDataDirectory/plugins. When you place a new plugin into this directory, TeamCity agents should re-connect and update docker-support.zip plugin
The patch is to fix `docker-support.zip!agent/docker-support.zip!docker-support/lib/docker-builder-agent.jar!commands.properties` file and to change the corresponding property `docker.inspect.default.network`. Sorry, this is a deep archive structure. Also, you should to increase plugin version in `docker-support.zip!teamcity-plugin.xml` file.
I've filed a bug request for this problem at https://youtrack.jetbrains.com/issue/TW-59068
Thanks for writing us about the problem!
Hello again,
The issue should be fixed and it contains a plugin with the fix: https://youtrack.jetbrains.com/issue/TW-59068
Thanks,