MCPcopy Create free account
hub / github.com/apache/arrow / docker_run

Function docker_run

dev/archery/archery/docker/cli.py:195–257  ·  view source on GitHub ↗

Execute Docker Compose builds. To see the available builds run `archery docker images`. Examples: # execute a single build archery docker run conda-python # execute the builds but disable the image pulling archery docker run --no-cache conda-python # pass a Dock

(obj, image, command, *, env, user, force_pull, force_build,
               build_only, use_cache, use_leaf_cache, resource_limit,
               volume)

Source from the content-addressed store, hash-verified

193 help="Set volume within the container")
194@click.pass_obj
195def docker_run(obj, image, command, *, env, user, force_pull, force_build,
196 build_only, use_cache, use_leaf_cache, resource_limit,
197 volume):
198 """
199 Execute Docker Compose builds.
200
201 To see the available builds run `archery docker images`.
202
203 Examples:
204
205 # execute a single build
206 archery docker run conda-python
207
208 # execute the builds but disable the image pulling
209 archery docker run --no-cache conda-python
210
211 # pass a Docker Compose parameter, like the python version
212 PYTHON=3.12 archery docker run conda-python
213
214 # disable the cache only for the leaf image
215 PANDAS=upstream_devel archery docker run --no-leaf-cache \
216 conda-python-pandas
217
218 # entirely skip building the image
219 archery docker run --no-pull --no-build conda-python
220
221 # pass runtime parameters via docker environment variables
222 archery docker run -e CMAKE_BUILD_TYPE=release ubuntu-cpp
223
224 # set a volume
225 archery docker run -v $PWD/build:/build ubuntu-cpp
226
227 # starting an interactive bash session for debugging
228 archery docker run ubuntu-cpp bash
229 """
230 compose = obj['compose']
231
232 env = dict(kv.split('=', 1) for kv in env)
233 try:
234 if force_pull:
235 with group("Docker: Pull"):
236 compose.pull(image, pull_leaf=use_leaf_cache)
237 if force_build:
238 with group("Docker: Build"):
239 compose.build(image, use_cache=use_cache,
240 use_leaf_cache=use_leaf_cache)
241 if build_only:
242 return
243 compose.run(
244 image,
245 command=command,
246 env=env,
247 user=user,
248 resource_limit=resource_limit,
249 volumes=volume
250 )
251 except UndefinedImage as e:
252 raise click.ClickException(

Callers 2

apt_buildMethod · 0.85
yum_buildMethod · 0.85

Calls 4

groupFunction · 0.50
pullMethod · 0.45
buildMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected