pub struct DockerSandbox { /* private fields */ }Expand description
Runs each command in a fresh container: the workspace is mounted at
/workspace, --network none unless allowed, and the container is
removed afterwards (and killed on timeout). No other host path is
mounted, so host paths in SandboxCommand::deny_read are out of reach
already; denied paths inside the workspace are covered by an empty
mount. On Unix the container runs as
the calling user so files it creates stay editable.
The docker CLI keeps the host environment (it needs DOCKER_HOST,
config paths and so on); the command inside sees only the spec’s env,
minus PATH and HOME, which come from the image.
Implementations§
Trait Implementations§
Source§impl Clone for DockerSandbox
impl Clone for DockerSandbox
Source§impl Debug for DockerSandbox
impl Debug for DockerSandbox
Source§impl Sandbox for DockerSandbox
impl Sandbox for DockerSandbox
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Short name recorded in receipts, for example
local or bubblewrap.Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Whether this backend can run commands here.
Source§fn is_contained(&self) -> bool
fn is_contained(&self) -> bool
Whether the backend confines writes to the workspace.
Source§fn enforces_deny_read(&self) -> bool
fn enforces_deny_read(&self) -> bool
Whether the backend keeps a command from reading the paths in
SandboxCommand::deny_read. Default false: a backend claims it
only when it enforces it, and callers refuse rather than pretend.Source§fn enforces_network_off(&self) -> bool
fn enforces_network_off(&self) -> bool
Whether the backend cuts the network when
SandboxCommand::allow_network is false. Default false, as for
Sandbox::enforces_deny_read.fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 SandboxCommand,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Forget for DockerSandbox
impl Freeze for DockerSandbox
impl Move for DockerSandbox
impl RefUnwindSafe for DockerSandbox
impl Send for DockerSandboxwhere
RawVecInner: Send,
impl Sync for DockerSandboxwhere
RawVecInner: Sync,
impl Unpin for DockerSandbox
impl UnsafeUnpin for DockerSandbox
impl UnwindSafe for DockerSandboxwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more