def run_container(name, image, command=None, environment=None,<EOL>ro=None, rw=None, links=None, detach=True, volumes_from=None,<EOL>port_bindings=None, log_syslog=False):
binds = ro_rw_to_binds(ro, rw)<EOL>log_config = LogConfig(type=LogConfig.types.JSON)<EOL>if log_syslog:<EOL><INDENT>log_config = LogConfig(<EOL>type=LogConfig.types.SYSLOG,<EOL>config={'<STR_LIT>': name})<EOL><DEDENT>host_config = _get_docker().create_host_config(binds=binds, log_config=log_config, links=links, volumes_from=volumes_from, port_bindings=port_bindings)<EOL>c = _get_docker().create_container(<EOL>name=name,<EOL>image=image,<EOL>command=command,<EOL>environment=environment,<EOL>volumes=binds_to_volumes(binds),<EOL>detach=detach,<EOL>stdin_open=False,<EOL>tty=False,<EOL>ports=list(port_bindings) if port_bindings else None,<EOL>host_config=host_config)<EOL>try:<EOL><INDENT>_get_docker().start(<EOL>container=c['<STR_LIT>'],<EOL>)<EOL><DEDENT>except APIError as e:<EOL><INDENT>if '<STR_LIT>' in e.explanation:<EOL><INDENT>try:<EOL><INDENT>_get_docker().remove_container(name, force=True)<EOL><DEDENT>except APIError:<EOL><INDENT>pass<EOL><DEDENT>raise PortAllocatedError()<EOL><DEDENT>raise<EOL><DEDENT>return c<EOL>
Wrapper for docker create_container, start calls

:param log_syslog: bool flag to redirect container's logs to host's syslog

:returns: container info dict or None if container couldn't be created

Raises PortAllocatedError if container couldn't start on the
requested port.