-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Description
Hi,
It will be very helpful to have something like "onrun" in the YAML to be able to run commands after the run. Similar to moby/moby#8860
mongodb:
image: mongo:3.0.2
hostname: myhostname
domainname: domain.lan
volumes:
- /data/mongodb:/data
ports:
- "27017:27017"
onrun:
- mongodump --host db2dump.domain.lan --port 27017 --out /data/mongodb/dumps/latest
- mongorestore -d database /data/mongodb/dumps/latest/database
After the mongodb start, It will dump db2dump.domain.lan and restore it.
When I will stop and then start the container, onrun part will no be executed to preserve idempotency.
EDIT 15 June 2020
5 years later, Compose wan't to "standardize" specifications,
please check compose-spec/compose-spec#84
jhliberty, crestone, kodeart, carloscarcamo, bardia-heydari and 259 moredaniilyar, myfreax, getrembl, michael-bucher, reduardo7 and 56 more
Metadata
Metadata
Assignees
Labels
No labels