mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
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>
31 lines
775 B
Bash
Executable file
31 lines
775 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright 2021 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
set -e
|
|
cd "$(dirname $0)/.."
|
|
|
|
cli_args=(
|
|
--rm
|
|
--volume $(pwd):/workspace:rw
|
|
--device /dev/net/tun
|
|
--device /dev/kvm
|
|
--volume /dev/log:/dev/log
|
|
--privileged
|
|
)
|
|
|
|
# Enable interactive mode when running in an interactive terminal.
|
|
if [ -t 1 ]; then
|
|
cli_args+=(-it)
|
|
fi
|
|
|
|
# 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) \
|
|
"$@"
|
|
|