mirror of https://github.com/docker/docs.git
				
				
				
			Set port_bindings to None when starting a one-off container in 'plum run'
This commit is contained in:
		
							parent
							
								
									beaa1dbc14
								
							
						
					
					
						commit
						fb69512008
					
				| 
						 | 
				
			
			@ -93,7 +93,7 @@ class TopLevelCommand(Command):
 | 
			
		|||
        }
 | 
			
		||||
        container = service.create_container(**container_options)
 | 
			
		||||
        stream = container.logs(stream=True)
 | 
			
		||||
        service.start_container(container)
 | 
			
		||||
        service.start_container(container, ports=None)
 | 
			
		||||
        for data in stream:
 | 
			
		||||
            if data is None:
 | 
			
		||||
                break
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,14 +63,21 @@ class Service(object):
 | 
			
		|||
    def start_container(self, container=None, **override_options):
 | 
			
		||||
        if container is None:
 | 
			
		||||
            container = self.create_container(**override_options)
 | 
			
		||||
 | 
			
		||||
        options = self.options.copy()
 | 
			
		||||
        options.update(override_options)
 | 
			
		||||
 | 
			
		||||
        port_bindings = {}
 | 
			
		||||
        for port in self.options.get('ports', []):
 | 
			
		||||
            port = unicode(port)
 | 
			
		||||
            if ':' in port:
 | 
			
		||||
                internal_port, external_port = port.split(':', 1)
 | 
			
		||||
                port_bindings[int(internal_port)] = int(external_port)
 | 
			
		||||
            else:
 | 
			
		||||
                port_bindings[int(port)] = None
 | 
			
		||||
 | 
			
		||||
        if options.get('ports', None) is not None:
 | 
			
		||||
            for port in options['ports']:
 | 
			
		||||
                port = unicode(port)
 | 
			
		||||
                if ':' in port:
 | 
			
		||||
                    internal_port, external_port = port.split(':', 1)
 | 
			
		||||
                    port_bindings[int(internal_port)] = int(external_port)
 | 
			
		||||
                else:
 | 
			
		||||
                    port_bindings[int(port)] = None
 | 
			
		||||
 | 
			
		||||
        log.info("Starting %s..." % container.name)
 | 
			
		||||
        container.start(
 | 
			
		||||
            links=self._get_links(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue