mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
Add override for container tool in dev_container
script
This change allows to override the command line tool that is used to start the dev container in the `tools/dev_container` script. The Makefile for creating the dev container uses the `DOCKER` env var to implement this, so this is used here as well. Rationale: Googlers are advised to not install Docker (go/dont-install-docker) and to use Podman instead. If the `DOCKER` variable is unset, the script will try to use Docker first and podman. Change-Id: I33bc8e4af632fa982406e838e762572407ccdc22 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3259939 Reviewed-by: Dennis Kempin <denniskempin@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Christian Blichmann <cblichmann@google.com>
This commit is contained in:
parent
528fcabc5d
commit
6addda2203
1 changed files with 8 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
set -e
|
||||
cd "$(dirname $0)/.."
|
||||
|
||||
docker_args=(
|
||||
cli_args=(
|
||||
--rm
|
||||
--volume $(pwd):/workspace:rw
|
||||
--device /dev/net/tun
|
||||
|
@ -17,11 +17,15 @@ docker_args=(
|
|||
|
||||
# Enable interactive mode when running in an interactive terminal.
|
||||
if [ -t 1 ]; then
|
||||
docker_args+=(-it)
|
||||
cli_args+=(-it)
|
||||
fi
|
||||
|
||||
docker run \
|
||||
${docker_args[@]} \
|
||||
# Allow to override the container CLI tool, similar to the Makefile. Try
|
||||
# "docker" first and fall back to "podman".
|
||||
DOCKER=${DOCKER:-$(which docker || which podman)}
|
||||
|
||||
"${DOCKER}" run \
|
||||
${cli_args[@]} \
|
||||
gcr.io/crosvm-packages/crosvm_dev:$(cat tools/impl/dev_container/version) \
|
||||
"$@"
|
||||
|
||||
|
|
Loading…
Reference in a new issue