testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
Loading...
Searching...
No Matches
testcontainers::Mount Class Reference

A single filesystem mount for a container, mapping to one entry of Docker's create-body HostConfig.Mounts array. More...

#include <testcontainers/Mount.hpp>

Public Member Functions

Mountwith_read_only (bool ro=true)
Mountwith_tmpfs_size (std::int64_t bytes)
Mountwith_tmpfs_mode (int mode)
MountType type () const noexcept
const std::string & source () const noexcept
const std::string & target () const noexcept
bool is_read_only () const noexcept
std::optional< std::int64_t > tmpfs_size () const noexcept
std::optional< int > tmpfs_mode () const noexcept

Static Public Member Functions

static Mount bind (std::string host_source, std::string container_target)
 Bind-mount a host path at container_target (Type=bind).
static Mount volume (std::string volume_name, std::string container_target)
 Mount a named volume at container_target (Type=volume).
static Mount tmpfs (std::string container_target)
 Mount an in-memory tmpfs at container_target (Type=tmpfs, no source).

Detailed Description

A single filesystem mount for a container, mapping to one entry of Docker's create-body HostConfig.Mounts array.

Build one with the static factories, then tune it with the chainable setters (same style as Healthcheck/GenericImage).

A plain, copyable value type (no Boost/Asio leakage).

Member Function Documentation

◆ bind()

Mount testcontainers::Mount::bind ( std::string host_source,
std::string container_target )
inlinestatic

Bind-mount a host path at container_target (Type=bind).

◆ volume()

Mount testcontainers::Mount::volume ( std::string volume_name,
std::string container_target )
inlinestatic

Mount a named volume at container_target (Type=volume).

◆ tmpfs()

Mount testcontainers::Mount::tmpfs ( std::string container_target)
inlinestatic

Mount an in-memory tmpfs at container_target (Type=tmpfs, no source).

◆ with_read_only()

Mount & testcontainers::Mount::with_read_only ( bool ro = true)
inline

◆ with_tmpfs_size()

Mount & testcontainers::Mount::with_tmpfs_size ( std::int64_t bytes)
inline

◆ with_tmpfs_mode()

Mount & testcontainers::Mount::with_tmpfs_mode ( int mode)
inline

◆ type()

MountType testcontainers::Mount::type ( ) const
inlinenoexcept

◆ source()

const std::string & testcontainers::Mount::source ( ) const
inlinenoexcept

◆ target()

const std::string & testcontainers::Mount::target ( ) const
inlinenoexcept

◆ is_read_only()

bool testcontainers::Mount::is_read_only ( ) const
inlinenoexcept

◆ tmpfs_size()

std::optional< std::int64_t > testcontainers::Mount::tmpfs_size ( ) const
inlinenoexcept

◆ tmpfs_mode()

std::optional< int > testcontainers::Mount::tmpfs_mode ( ) const
inlinenoexcept