Ejemplo n.º 1
0
    def create_service(self, name, **kwargs):
        if 'image' not in kwargs and 'build' not in kwargs:
            kwargs['image'] = 'busybox:latest'

        if 'command' not in kwargs:
            kwargs['command'] = ["top"]

        links = kwargs.get('links', None)
        volumes_from = kwargs.get('volumes_from', None)
        net = kwargs.get('net', None)

        workaround_options = ['links', 'volumes_from', 'net']
        for key in workaround_options:
            try:
                del kwargs[key]
            except KeyError:
                pass

        options = ServiceLoader(working_dir='.',
                                filename=None,
                                service_name=name,
                                service_dict=kwargs).make_service_dict()

        labels = options.setdefault('labels', {})
        labels['com.docker.compose.test-name'] = self.id()

        if links:
            options['links'] = links
        if volumes_from:
            options['volumes_from'] = volumes_from
        if net:
            options['net'] = net

        return Service(project='composetest', client=self.client, **options)
Ejemplo n.º 2
0
    def create_service(self, name, **kwargs):
        if 'image' not in kwargs and 'build' not in kwargs:
            kwargs['image'] = 'busybox:latest'

        if 'command' not in kwargs:
            kwargs['command'] = ["top"]

        links = kwargs.get('links', None)
        volumes_from = kwargs.get('volumes_from', None)
        net = kwargs.get('net', None)

        workaround_options = ['links', 'volumes_from', 'net']
        for key in workaround_options:
            try:
                del kwargs[key]
            except KeyError:
                pass

        options = ServiceLoader(working_dir='.', filename=None, service_name=name, service_dict=kwargs).make_service_dict()

        labels = options.setdefault('labels', {})
        labels['com.docker.compose.test-name'] = self.id()

        if links:
            options['links'] = links
        if volumes_from:
            options['volumes_from'] = volumes_from
        if net:
            options['net'] = net

        return Service(
            project='composetest',
            client=self.client,
            **options
        )
Ejemplo n.º 3
0
    def create_service(self, name, **kwargs):
        if 'image' not in kwargs and 'build' not in kwargs:
            kwargs['image'] = 'busybox:latest'

        if 'command' not in kwargs:
            kwargs['command'] = ["top"]

        options = ServiceLoader(working_dir='.').make_service_dict(
            name, kwargs)

        labels = options.setdefault('labels', {})
        labels['com.docker.compose.test-name'] = self.id()

        return Service(project='composetest', client=self.client, **options)
Ejemplo n.º 4
0
    def create_service(self, name, **kwargs):
        if 'image' not in kwargs and 'build' not in kwargs:
            kwargs['image'] = 'busybox:latest'

        if 'command' not in kwargs:
            kwargs['command'] = ["top"]

        options = ServiceLoader(working_dir='.').make_service_dict(name, kwargs)

        labels = options.setdefault('labels', {})
        labels['com.docker.compose.test-name'] = self.id()

        return Service(
            project='composetest',
            client=self.client,
            **options
        )