|
testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
|
A request to copy a host file, in-memory bytes, or a host directory tree into a container, mapping to a tar PUTed to PUT /containers/{id}/archive. More...
#include <testcontainers/CopyToContainer.hpp>
Public Member Functions | |
| CopyToContainer & | with_mode (int mode) |
| Set the octal file mode of created regular-file entries (e.g. | |
| bool | is_file () const noexcept |
| True if the source is a host file. | |
| bool | is_dir () const noexcept |
| True if the source is a host directory tree. | |
| const std::filesystem::path & | host_path () const noexcept |
| const std::string & | bytes () const noexcept |
| const std::string & | target () const noexcept |
| int | mode () const noexcept |
Static Public Member Functions | |
| static CopyToContainer | host_file (std::filesystem::path host_path, std::string container_target) |
| Copy a host file (host_path on the local filesystem) to container_target (an absolute path in the container, e.g. | |
| static CopyToContainer | content (std::string bytes, std::string container_target) |
| Copy in-memory bytes to container_target. | |
| static CopyToContainer | host_dir (std::filesystem::path host_dir, std::string container_target) |
| Copy a host directory recursively: everything under host_dir lands under container_target (an absolute directory path in the container, e.g. | |
A request to copy a host file, in-memory bytes, or a host directory tree into a container, mapping to a tar PUTed to PUT /containers/{id}/archive.
Three sources: a host file (read at copy time), raw in-memory bytes (which may be binary, including embedded NULs), or a host directory copied recursively. Build one with a static factory, then optionally tune the file mode with the chainable setter (same style as Mount/Healthcheck).
Container-side targets are '/'-separated absolute paths regardless of the host OS. On a Windows-containers engine a drive-rooted target such as C:\dir\file (or C:/dir/file) is also accepted and treated as /dir/file, which the daemon extracts relative to C:\\endiskip.
A plain, copyable value type (no Boost/Asio/libarchive leakage).
|
inlinestatic |
Copy a host file (host_path on the local filesystem) to container_target (an absolute path in the container, e.g.
"/tmp/foo.txt"). The file is read when the copy runs. The target's parent directory must already exist in the container.
|
inlinestatic |
Copy in-memory bytes to container_target.
bytes is taken verbatim and may be binary (embedded NULs are preserved).
|
inlinestatic |
Copy a host directory recursively: everything under host_dir lands under container_target (an absolute directory path in the container, e.g.
"/opt/data"), which is created — along with any missing intermediate directories — by the extraction. Empty directories are preserved. Regular files get mode() (default 0644); directories are always 0755. File symlinks are followed (their contents are copied); directory symlinks are not descended into. The tree is read when the copy runs.
|
inline |
Set the octal file mode of created regular-file entries (e.g.
0644). Defaults to 0644 when unset. For a directory source this applies to every file in the tree (directories are always 0755).
|
inlinenoexcept |
True if the source is a host file.
|
inlinenoexcept |
True if the source is a host directory tree.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |