compose icon indicating copy to clipboard operation
compose copied to clipboard

Dependent service not working correctly when defined via `extends`

Open thisismydesign opened this issue 4 years ago • 6 comments

Description of the issue

I have a docker-compose file that starts a few services from different repos. The repos are also standalone with their own docker-compose files so I want to reuse that. I ended up with:

services:
  elasticsearch:
    extends:
      file: ../other-service/docker-compose.yml
      service: elasticsearch

  web:
    extends:
      file: ../other-service/docker-compose.common.yml
      service: web
    build:
      context: ../other-service
    depends_on:
      - elasticsearch

Then when I do dc up web I see both services correctly creating but there are no logs from elasticsearch. Further, when I ctrl+c out of the process, it only closes the web service. Using docker ps I still see elasticsearch runnnig and I have to do dc down to stop it.

If I define the elasticsearch service in place (exactly the same definition as in the other file) it works perfectly. The service definition is a basic out-of-the-box one:

  elasticsearch:
    image: elasticsearch:6.5.4
    environment:
      - ...
    ports:
      - ...

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker version

Client: Docker Engine - Community
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:47 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

thisismydesign avatar Jul 05 '21 14:07 thisismydesign

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 03 '22 20:01 stale[bot]

I think this was caused by starting a specific service, in which case dependencies start in the background. This is annoying but doesn't have to do with extends

thisismydesign avatar Jan 04 '22 18:01 thisismydesign

This issue has been automatically marked as not stale anymore due to the recent activity.

stale[bot] avatar Jan 04 '22 18:01 stale[bot]

Feel free to close

thisismydesign avatar Jan 04 '22 18:01 thisismydesign

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 10 '22 12:07 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Jul 31 '22 23:07 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Aug 13 '22 11:08 stale[bot]

This issue has been automatically marked as not stale anymore due to the recent activity.

stale[bot] avatar Aug 13 '22 12:08 stale[bot]