Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compose/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'image',
'links',
'mem_limit',
'memswap_limit',
'net',
'pid',
'ports',
Expand Down
3 changes: 2 additions & 1 deletion docs/yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ dns_search:
- dc2.example.com
```

### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares
### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, memswap\_limit, privileged, restart, stdin\_open, tty, cpu\_shares

Each of these is a single value, analogous to its
[docker run](https://docs.docker.com/reference/run/) counterpart.
Expand All @@ -299,6 +299,7 @@ hostname: foo
domainname: foo.com

mem_limit: 1000000000
memswap_limit: 2000000000
privileged: true

restart: always
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def test_create_container_with_cpu_shares(self):
service.start_container(container)
self.assertEqual(container.inspect()['Config']['CpuShares'], 73)

def test_create_container_with_memswap_limit(self):
service = self.create_service('db', memswap_limit='200m', mem_limit='200m')
container = service.create_container()
service.start_container(container)
self.assertEqual(container.inspect()['Config']['MemorySwap'], 209715200)

def test_create_container_with_specified_volume(self):
host_path = '/tmp/host-path'
container_path = '/container-path'
Expand Down