mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
Merge pull request #490 from LuminosoInsight/insecure-pull
Allow pulls from an insecure registry
This commit is contained in:
commit
431fdaa0f1
@ -213,9 +213,17 @@ class TopLevelCommand(Command):
|
|||||||
"""
|
"""
|
||||||
Pulls images for services.
|
Pulls images for services.
|
||||||
|
|
||||||
Usage: pull [SERVICE...]
|
Usage: pull [options] [SERVICE...]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--allow-insecure-ssl Allow insecure connections to the docker
|
||||||
|
registry
|
||||||
"""
|
"""
|
||||||
project.pull(service_names=options['SERVICE'])
|
insecure_registry = options['--allow-insecure-ssl']
|
||||||
|
project.pull(
|
||||||
|
service_names=options['SERVICE'],
|
||||||
|
insecure_registry=insecure_registry
|
||||||
|
)
|
||||||
|
|
||||||
def rm(self, project, options):
|
def rm(self, project, options):
|
||||||
"""
|
"""
|
||||||
|
@ -180,9 +180,9 @@ class Project(object):
|
|||||||
|
|
||||||
return running_containers
|
return running_containers
|
||||||
|
|
||||||
def pull(self, service_names=None):
|
def pull(self, service_names=None, insecure_registry=False):
|
||||||
for service in self.get_services(service_names, include_links=True):
|
for service in self.get_services(service_names, include_links=True):
|
||||||
service.pull()
|
service.pull(insecure_registry=insecure_registry)
|
||||||
|
|
||||||
def remove_stopped(self, service_names=None, **options):
|
def remove_stopped(self, service_names=None, **options):
|
||||||
for service in self.get_services(service_names):
|
for service in self.get_services(service_names):
|
||||||
|
@ -423,10 +423,13 @@ class Service(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def pull(self):
|
def pull(self, insecure_registry=False):
|
||||||
if 'image' in self.options:
|
if 'image' in self.options:
|
||||||
log.info('Pulling %s (%s)...' % (self.name, self.options.get('image')))
|
log.info('Pulling %s (%s)...' % (self.name, self.options.get('image')))
|
||||||
self.client.pull(self.options.get('image'))
|
self.client.pull(
|
||||||
|
self.options.get('image'),
|
||||||
|
insecure_registry=insecure_registry
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
NAME_RE = re.compile(r'^([^_]+)_([^_]+)_(run_)?(\d+)$')
|
NAME_RE = re.compile(r'^([^_]+)_([^_]+)_(run_)?(\d+)$')
|
||||||
|
2
setup.py
2
setup.py
@ -31,7 +31,7 @@ install_requires = [
|
|||||||
'texttable >= 0.8.1, < 0.9',
|
'texttable >= 0.8.1, < 0.9',
|
||||||
'websocket-client >= 0.11.0, < 0.12',
|
'websocket-client >= 0.11.0, < 0.12',
|
||||||
'dockerpty >= 0.2.3, < 0.3',
|
'dockerpty >= 0.2.3, < 0.3',
|
||||||
'docker-py >= 0.3.2, < 0.6',
|
'docker-py >= 0.5, < 0.6',
|
||||||
'six >= 1.3.0, < 2',
|
'six >= 1.3.0, < 2',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -167,6 +167,13 @@ class ServiceTest(unittest.TestCase):
|
|||||||
mock_container_class.from_ps.assert_called_once_with(
|
mock_container_class.from_ps.assert_called_once_with(
|
||||||
mock_client, container_dict)
|
mock_client, container_dict)
|
||||||
|
|
||||||
|
@mock.patch('fig.service.log', autospec=True)
|
||||||
|
def test_pull_image(self, mock_log):
|
||||||
|
service = Service('foo', client=self.mock_client, image='someimage:sometag')
|
||||||
|
service.pull(insecure_registry=True)
|
||||||
|
self.mock_client.pull.assert_called_once_with('someimage:sometag', insecure_registry=True)
|
||||||
|
mock_log.info.assert_called_once_with('Pulling foo (someimage:sometag)...')
|
||||||
|
|
||||||
|
|
||||||
class ServiceVolumesTest(unittest.TestCase):
|
class ServiceVolumesTest(unittest.TestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user