mirror of
https://github.com/docker/compose.git
synced 2025-06-02 04:40:14 +02:00
Add cpu_shares option in fig.yml
This options maps exactly the docker run option with the same name. Signed-off-by: Christophe Labouisse <christophe@labouisse.org>
This commit is contained in:
parent
4ef2e21cca
commit
aa0c43df96
@ -194,11 +194,13 @@ dns_search:
|
|||||||
- dc2.example.com
|
- 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.
|
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
|
working_dir: /code
|
||||||
entrypoint: /code/entrypoint.sh
|
entrypoint: /code/entrypoint.sh
|
||||||
user: postgresql
|
user: postgresql
|
||||||
|
@ -18,6 +18,7 @@ log = logging.getLogger(__name__)
|
|||||||
DOCKER_CONFIG_KEYS = [
|
DOCKER_CONFIG_KEYS = [
|
||||||
'cap_add',
|
'cap_add',
|
||||||
'cap_drop',
|
'cap_drop',
|
||||||
|
'cpu_shares',
|
||||||
'command',
|
'command',
|
||||||
'detach',
|
'detach',
|
||||||
'dns',
|
'dns',
|
||||||
@ -41,6 +42,7 @@ DOCKER_CONFIG_KEYS = [
|
|||||||
'working_dir',
|
'working_dir',
|
||||||
]
|
]
|
||||||
DOCKER_CONFIG_HINTS = {
|
DOCKER_CONFIG_HINTS = {
|
||||||
|
'cpu_share' : 'cpu_shares',
|
||||||
'link' : 'links',
|
'link' : 'links',
|
||||||
'port' : 'ports',
|
'port' : 'ports',
|
||||||
'privilege' : 'privileged',
|
'privilege' : 'privileged',
|
||||||
|
@ -100,6 +100,12 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
self.assertIn('/var/db', container.inspect()['Volumes'])
|
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):
|
def test_create_container_with_specified_volume(self):
|
||||||
host_path = '/tmp/host-path'
|
host_path = '/tmp/host-path'
|
||||||
container_path = '/container-path'
|
container_path = '/container-path'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user