Skip to content

Add ability to inherit services - #625

Closed
matthuisman wants to merge 3 commits into
docker:masterfrom
matthuisman:master
Closed

matthuisman wants to merge 3 commits into
docker:masterfrom
matthuisman:master

Conversation

@matthuisman

Copy link
Copy Markdown

#610

Just initial code for discussion.

Currently, attributes 'command' 'ports' and 'name' won't be copied over to child.

example fig.yml to use

serviceA:
  image: ubuntu:14.04
  volumes:
    - /serviceA:/serviceA
  environment:
    PROJECT: services
    SERVICE: serviceA
  command: /bin/sh -c "while true; do echo $PROJECT; echo $SERVICE; echo ServiceA $(date) > /serviceA/date; sleep 1; done"

serviceB:
  inherits: serviceA
  volumes:
    - /serviceB:/serviceB
  environment:
    SERVICE: serviceB
  command: /bin/sh -c "while true; do echo $PROJECT; echo $SERVICE; echo $(cat /serviceA/date); echo ServiceB $(date) > /serviceB/date; sleep 1;  done"

serviceC:
  inherits: serviceB
  command: /bin/sh -c "while true; do echo $PROJECT; echo $SERVICE; echo $(cat /serviceA/date); echo $(cat /serviceB/date); sleep 1;  done"

To Do:
Add tests
Rename: DONT_INHERIT to something nicer
Maybe make the keyword something else: "extends"?
Possibly an option to disable inherit of certain attribute

@matthuisman matthuisman changed the title Add ability to inherit attributes from services Add ability to inherit services Nov 7, 2014
@matthuisman matthuisman mentioned this pull request Nov 7, 2014
@dnephin

dnephin commented May 31, 2015

Copy link
Copy Markdown

This is now supported with extends

@dnephin dnephin closed this May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants