Skip to content

Commit

Permalink
Merge pull request docker#830 from ggtools/cpu_shares
Browse files Browse the repository at this point in the history
Add cpu_shares option in fig.yml
  • Loading branch information
aanand committed Jan 12, 2015
2 parents 4ef2e21 + aa0c43d commit 74a0c47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ dns_search:
- dc2.example.com
```

### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty
### working\_dir, entrypoint, user, hostname, domainname, mem\_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.

```
cpu_shares: 73
working_dir: /code
entrypoint: /code/entrypoint.sh
user: postgresql
Expand Down
2 changes: 2 additions & 0 deletions fig/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DOCKER_CONFIG_KEYS = [
'cap_add',
'cap_drop',
'cpu_shares',
'command',
'detach',
'dns',
Expand All @@ -41,6 +42,7 @@
'working_dir',
]
DOCKER_CONFIG_HINTS = {
'cpu_share' : 'cpu_shares',
'link' : 'links',
'port' : 'ports',
'privilege' : 'privileged',
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 @@ -100,6 +100,12 @@ def test_create_container_with_unspecified_volume(self):
service.start_container(container)
self.assertIn('/var/db', container.inspect()['Volumes'])

def test_create_container_with_cpu_shares(self):
service = self.create_service('db', cpu_shares=73)
container = service.create_container()
service.start_container(container)
self.assertEqual(container.inspect()['Config']['CpuShares'], 73)

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

0 comments on commit 74a0c47

Please sign in to comment.