def web_command(command, ro=None, rw=None, links=None,<EOL>image='<STR_LIT>', volumes_from=None, commit=False,<EOL>clean_up=False, stream_output=None, entrypoint=None):
binds = ro_rw_to_binds(ro, rw)<EOL>c = _get_docker().create_container(<EOL>image=image,<EOL>command=command,<EOL>volumes=binds_to_volumes(binds),<EOL>detach=False,<EOL>host_config=_get_docker().create_host_config(binds=binds, volumes_from=volumes_from, links=links),<EOL>entrypoint=entrypoint)<EOL>_get_docker().start(<EOL>container=c['<STR_LIT>'],<EOL>)<EOL>if stream_output:<EOL><INDENT>for output in _get_docker().attach(<EOL>c['<STR_LIT>'], stdout=True, stderr=True, stream=True):<EOL><INDENT>stream_output.write(output)<EOL><DEDENT><DEDENT>if _get_docker().wait(c['<STR_LIT>']):<EOL><INDENT>logs = _get_docker().logs(c['<STR_LIT>'])<EOL>if clean_up:<EOL><INDENT>remove_container(c['<STR_LIT>'])<EOL><DEDENT>raise WebCommandError(command, c['<STR_LIT>'][:<NUM_LIT:12>], logs)<EOL><DEDENT>if commit:<EOL><INDENT>rval = _get_docker().commit(c['<STR_LIT>'])<EOL><DEDENT>if not remove_container(c['<STR_LIT>']):<EOL><INDENT>if not environ.get('<STR_LIT>', False):<EOL><INDENT>warn('<STR_LIT>'.format(c['<STR_LIT>']))<EOL><DEDENT><DEDENT>if commit:<EOL><INDENT>return rval['<STR_LIT>']<EOL><DEDENT>
Run a single command in a web image optionally preloaded with the ckan
source and virtual envrionment.

:param command: command to execute
:param ro: {localdir: binddir} dict for read-only volumes
:param rw: {localdir: binddir} dict for read-write volumes
:param links: links passed to start
:param image: docker image name to use
:param volumes_from:
:param commit: True to create a new image based on result
:param clean_up: True to remove container even on error
:param stream_output: file to write stderr+stdout from command
:param entrypoint: override entrypoint (script that runs command)

:returns: image id if commit=True