-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compose): ability to retain volumes when using context manager (#…
…659) # changes On fiddling with a local project of mine, I realised we default to removing volumes when using compose. This is neat, but the context manager should also allow control over the volumes kept. This change adds the `keep_volumes` flag and hooks into `self.stop()` that already had the option. I added a test to cover the new functionality :
- Loading branch information
1 parent
b1453e8
commit e1e3d13
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
core/tests/compose_fixtures/basic_volume/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
services: | ||
alpine: | ||
image: alpine:latest | ||
init: true | ||
command: | ||
- sh | ||
- -c | ||
- 'while true; do sleep 0.1 ; date -Ins; done' | ||
read_only: true | ||
volumes: | ||
- type: volume | ||
source: my-data | ||
target: /var/lib/example/data | ||
read_only: false | ||
|
||
volumes: | ||
my-data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters