[−][src]Struct bollard::Docker
Docker
The main interface for calling the Docker API. Construct a new Docker instance using one of the connect methods:
Methods
impl Docker
[src]
pub fn list_containers<T, K>(
&self,
options: Option<T>
) -> impl Future<Item = Vec<APIContainers>, Error = Error> where
T: ListContainersQueryParams<K, String>,
K: AsRef<str>,
[src]
&self,
options: Option<T>
) -> impl Future<Item = Vec<APIContainers>, Error = Error> where
T: ListContainersQueryParams<K, String>,
K: AsRef<str>,
List Containers
Returns a list of containers.
Arguments
- Optional ListContainersOptions struct.
Returns
- Vector of APIContainers, wrapped in a Future.
Examples
use bollard::container::{ListContainersOptions}; use std::collections::HashMap; use std::default::Default; let mut filters = HashMap::new(); filters.insert("health", vec!("unhealthy")); let options = Some(ListContainersOptions{ all: true, filters: filters, ..Default::default() }); docker.list_containers(options);
pub fn create_container<T, K, V, Z>(
&self,
options: Option<T>,
config: Config<Z>
) -> impl Future<Item = CreateContainerResults, Error = Error> where
T: CreateContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Z: AsRef<str> + Eq + Hash + Serialize,
[src]
&self,
options: Option<T>,
config: Config<Z>
) -> impl Future<Item = CreateContainerResults, Error = Error> where
T: CreateContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Z: AsRef<str> + Eq + Hash + Serialize,
Create Container
Prepares a container for a subsequent start operation.
Arguments
- Optional Create Container Options struct.
- Container Config struct.
Returns
- Create Container Results, wrapped in a Future.
Examples
use bollard::container::{CreateContainerOptions, Config}; use std::default::Default; let options = Some(CreateContainerOptions{ name: "my-new-container", }); let config = Config { image: Some("hello-world"), cmd: Some(vec!["/hello"]), ..Default::default() }; docker.create_container(options, config);
pub fn start_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: StartContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: StartContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Start Container
Starts a container, after preparing it with the Create Container API.
Arguments
- Container name as a string slice.
- Optional Start Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::StartContainerOptions; docker.start_container("hello-world", None::<StartContainerOptions<String>>);
pub fn stop_container<T, K>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: StopContainerQueryParams<K>,
K: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: StopContainerQueryParams<K>,
K: AsRef<str>,
Stop Container
Stops a container.
Arguments
- Container name as string slice.
- Optional Stop Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::StopContainerOptions; let options = Some(StopContainerOptions{ t: 30, }); docker.stop_container("hello-world", options);
pub fn remove_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: RemoveContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: RemoveContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Remove Container
Remove a container.
Arguments
- Container name as a string slice.
- Optional Remove Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::RemoveContainerOptions; use std::default::Default; let options = Some(RemoveContainerOptions{ force: true, ..Default::default() }); docker.remove_container("hello-world", options);
pub fn wait_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = WaitContainerResults, Error = Error> where
T: WaitContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = WaitContainerResults, Error = Error> where
T: WaitContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Wait Container
Wait for a container to stop. This is a non-blocking operation, the resulting stream will end when the container stops.
Arguments
- Container name as string slice.
- Optional Wait Container Options struct.
Returns
- Wait Container Results, wrapped in a Stream.
Examples
use bollard::container::WaitContainerOptions; let options = Some(WaitContainerOptions{ condition: "not-running", }); docker.wait_container("hello-world", options);
pub fn restart_container<T, K>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: RestartContainerQueryParams<K>,
K: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: RestartContainerQueryParams<K>,
K: AsRef<str>,
Restart Container
Restart a container.
Arguments
- Container name as string slice.
- Optional Restart Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::RestartContainerOptions; let options = Some(RestartContainerOptions{ t: 30, }); docker.restart_container("postgres", options);
pub fn inspect_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = Container, Error = Error> where
T: InspectContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = Container, Error = Error> where
T: InspectContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Inspect Container
Inspect a container.
Arguments
- Container name as a string slice.
- Optional Inspect Container Options struct.
Returns
- Container, wrapped in a Future.
Examples
use bollard::container::InspectContainerOptions; let options = Some(InspectContainerOptions{ size: false, }); docker.inspect_container("hello-world", options);
pub fn top_processes<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = TopResult, Error = Error> where
T: TopQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = TopResult, Error = Error> where
T: TopQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Top Processes
List processes running inside a container.
Arguments
- Container name as string slice.
- Optional Top Options struct.
Returns
- TopResult, wrapped in a Future.
Examples
use bollard::container::TopOptions; let options = Some(TopOptions{ ps_args: "aux", }); docker.top_processes("fnichol/uhttpd", options);
pub fn logs<T, K>(
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = LogOutput, Error = Error> where
T: LogsQueryParams<K>,
K: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = LogOutput, Error = Error> where
T: LogsQueryParams<K>,
K: AsRef<str>,
Logs
Get container logs.
Arguments
- Container name as string slice.
- Optional Logs Options struct.
Returns
- Log Output enum, wrapped in a Stream.
Examples
use bollard::container::LogsOptions; use std::default::Default; let options = Some(LogsOptions{ stdout: true, ..Default::default() }); docker.logs("hello-world", options);
pub fn container_changes(
&self,
container_name: &str
) -> impl Future<Item = Option<Vec<Change>>, Error = Error>
[src]
&self,
container_name: &str
) -> impl Future<Item = Option<Vec<Change>>, Error = Error>
Container Changes
Get changes on a container's filesystem.
Arguments
- Container name as string slice.
Returns
- An Option of Vector of Change structs, wrapped in a Future.
Examples
docker.container_changes("hello-world");
pub fn stats<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = Stats, Error = Error> where
T: StatsQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = Stats, Error = Error> where
T: StatsQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Stats
Get container stats based on resource usage.
Arguments
- Container name as string slice.
- Optional Stats Options struct.
Returns
- Stats struct, wrapped in a Stream.
Examples
use bollard::container::StatsOptions; let options = Some(StatsOptions{ stream: false, }); docker.stats("hello-world", options);
pub fn kill_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: KillContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: KillContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Kill Container
Kill a container.
Arguments
- Container name as string slice.
- Optional Kill Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::KillContainerOptions; let options = Some(KillContainerOptions{ signal: "SIGINT", }); docker.kill_container("postgres", options);
pub fn update_container(
&self,
container_name: &str,
config: UpdateContainerOptions
) -> impl Future<Item = (), Error = Error>
[src]
&self,
container_name: &str,
config: UpdateContainerOptions
) -> impl Future<Item = (), Error = Error>
Update Container
Update a container.
Arguments
- Container name as string slice.
- Update Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::UpdateContainerOptions; use std::default::Default; let config = UpdateContainerOptions { memory: Some(314572800), memory_swap: Some(314572800), ..Default::default() }; docker.update_container("postgres", config);
pub fn rename_container<T, K, V>(
&self,
container_name: &str,
options: T
) -> impl Future<Item = (), Error = Error> where
T: RenameContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: T
) -> impl Future<Item = (), Error = Error> where
T: RenameContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Rename Container
Rename a container.
Arguments
- Container name as string slice.
- Rename Container Options struct
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::RenameContainerOptions; let required = RenameContainerOptions { name: "my_new_container_name" }; docker.rename_container("hello-world", required);
pub fn pause_container(
&self,
container_name: &str
) -> impl Future<Item = (), Error = Error>
[src]
&self,
container_name: &str
) -> impl Future<Item = (), Error = Error>
Pause Container
Use the cgroups freezer to suspend all processes in a container.
Arguments
- Container name as a string slice.
Returns
- unit type
()
, wrapped in a Future.
Examples
docker.pause_container("postgres");
pub fn unpause_container(
&self,
container_name: &str
) -> impl Future<Item = (), Error = Error>
[src]
&self,
container_name: &str
) -> impl Future<Item = (), Error = Error>
Unpause Container
Resume a container which has been paused.
Arguments
- Container name as a string slice.
Returns
- unit type
()
, wrapped in a Future.
Examples
docker.unpause_container("postgres");
pub fn prune_containers<T, K>(
&self,
options: Option<T>
) -> impl Future<Item = PruneContainersResults, Error = Error> where
T: PruneContainersQueryParams<K>,
K: AsRef<str> + Eq + Hash,
[src]
&self,
options: Option<T>
) -> impl Future<Item = PruneContainersResults, Error = Error> where
T: PruneContainersQueryParams<K>,
K: AsRef<str> + Eq + Hash,
Prune Containers
Delete stopped containers.
Arguments
- Optional Prune Containers Options struct.
Returns
- PruneContainersResults struct, wrapped in a Future.
Examples
use bollard::container::PruneContainersOptions; use std::collections::HashMap; let mut filters = HashMap::new(); filters.insert("until", vec!("10m")); let options = Some(PruneContainersOptions{ filters: filters }); docker.prune_containers(options);
pub fn upload_to_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>,
tar: Body
) -> impl Future<Item = (), Error = Error> where
T: UploadToContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>,
tar: Body
) -> impl Future<Item = (), Error = Error> where
T: UploadToContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Upload To Container
Upload a tar archive to be extracted to a path in the filesystem of container id.
Arguments
- Optional Upload To Container Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::container::UploadToContainerOptions; use std::default::Default; use std::fs::File; use std::io::Read; let options = Some(UploadToContainerOptions{ path: "/opt", ..Default::default() }); let mut file = File::open("tarball.tar.gz").unwrap(); let mut contents = Vec::new(); file.read_to_end(&mut contents).unwrap(); docker.upload_to_container("my-container", options, contents.into());
pub fn download_from_container<T, K, V>(
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = Chunk, Error = Error> where
T: DownloadFromContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
container_name: &str,
options: Option<T>
) -> impl Stream<Item = Chunk, Error = Error> where
T: DownloadFromContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Download From Container
Get a tar archive of a resource in the filesystem of container id.
Arguments
- Download From Container Options struct.
Returns
- Tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. Hyper Body.
Examples
use bollard::container::DownloadFromContainerOptions; let options = Some(DownloadFromContainerOptions{ path: "/opt", }); docker.download_from_container("my-container", options);
impl Docker
[src]
A Docker implementation typed to connect to an unsecure Http connection.
pub fn connect_with_http_defaults() -> Result<Docker, Error>
[src]
Connect using unsecured HTTP using defaults that are signalled by environment variables.
Defaults
- The connection url is sourced from the
DOCKER_HOST
environment variable, and defaults tolocalhost:2375
. - The number of threads used for the HTTP connection pool defaults to 1.
- The request timeout defaults to 2 minutes.
Examples
use bollard::Docker; use futures::future::Future; let connection = Docker::connect_with_http_defaults().unwrap(); connection.ping() .and_then(|_| Ok(println!("Connected!")));
pub fn connect_with_http(
addr: &str,
num_threads: usize,
timeout: u64
) -> Result<Docker, Error>
[src]
addr: &str,
num_threads: usize,
timeout: u64
) -> Result<Docker, Error>
Connect using unsecured HTTP.
Arguments
addr
: connection url including scheme and port.num_threads
: the number of threads for the HTTP connection pool.timeout
: the read/write timeout (seconds) to use for every hyper connection
Examples
use bollard::Docker; use futures::future::Future; let connection = Docker::connect_with_http( "http://my-custom-docker-server:2735", 4, 20) .unwrap(); connection.ping() .and_then(|_| Ok(println!("Connected!")));
impl Docker
[src]
A Docker implementation typed to connect to a Unix socket.
pub fn connect_with_unix_defaults() -> Result<Docker, Error>
[src]
Connect using a Unix socket using defaults that are signalled by environment variables.
Defaults
- The socket location defaults to
/var/run/docker.sock
. - The request timeout defaults to 2 minutes.
Examples
use bollard::Docker; use futures::future::Future; let connection = Docker::connect_with_unix_defaults().unwrap(); connection.ping().and_then(|_| Ok(println!("Connected!")));
pub fn connect_with_unix(addr: &str, timeout: u64) -> Result<Docker, Error>
[src]
Connect using a Unix socket.
Arguments
addr
: connection socket path.timeout
: the read/write timeout (seconds) to use for every hyper connection
Examples
use bollard::Docker; use futures::future::Future; let connection = Docker::connect_with_unix("/var/run/docker.sock", 120).unwrap(); connection.ping().and_then(|_| Ok(println!("Connected!")));
impl Docker
[src]
A Docker implementation that wraps away which local implementation we are calling.
pub fn connect_with_local_defaults() -> Result<Docker, Error>
[src]
Connect using the local machine connection method with default arguments.
This is a simple wrapper over the OS specific handlers:
pub fn connect_with_local(addr: &str, timeout: u64) -> Result<Docker, Error>
[src]
Connect using the local machine connection method with supplied arguments.
This is a simple wrapper over the OS specific handlers:
- Unix:
Docker::connect_with_unix
- Windows:
Docker::connect_with_named_pipe
impl Docker
[src]
A Docker implementation typed to connect to a secure HTTPS connection, using the native rust TLS library.
pub fn connect_with_tls_defaults() -> Result<Docker, Error>
[src]
Connect using secure HTTPS using native TLS and defaults that are signalled by environment variables.
Defaults
- The connection url is sourced from the
DOCKER_HOST
environment variable. - The certificate directory is sourced from the
DOCKER_CERT_PATH
environment variable. - Certificate PKCS #12 archive is named
identity.pfx
and the certificate chain is namedca.pem
. - The password for the PKCS #12 archive defaults to an empty password.
- The number of threads used for the HTTP connection pool defaults to 1.
- The request timeout defaults to 2 minutes.
PKCS12
PKCS #12 archives can be created with OpenSSL:
openssl pkcs12 -export -out identity.pfx -inkey key.pem -in cert.pem -certfile
chain_certs.pem
Examples
use bollard::Docker; use futures::future::Future; let connection = Docker::connect_with_tls_defaults().unwrap(); connection.ping() .and_then(|_| Ok(println!("Connected!")));
pub fn connect_with_tls(
addr: &str,
pkcs12_file: &Path,
ca_file: &Path,
pkcs12_password: &str,
num_thread: usize,
timeout: u64
) -> Result<Docker, Error>
[src]
addr: &str,
pkcs12_file: &Path,
ca_file: &Path,
pkcs12_password: &str,
num_thread: usize,
timeout: u64
) -> Result<Docker, Error>
Connect using secure HTTPS using native TLS.
Arguments
addr
: the connection url.pkcs12_file
: the PKCS #12 archive.ca_file
: the certificate chain.pkcs12_password
: the password to the PKCS #12 archive.num_threads
: the number of threads for the HTTP connection pool.timeout
: the read/write timeout (seconds) to use for every hyper connection
PKCS12
PKCS #12 archives can be created with OpenSSL:
openssl pkcs12 -export -out identity.pfx -inkey key.pem -in cert.pem -certfile
chain_certs.pem
Examples
use bollard::Docker; use std::path::Path; use futures::future::Future; let connection = Docker::connect_with_tls( "localhost:2375", Path::new("/certs/identity.pfx"), Path::new("/certs/ca.pem"), "my_secret_password", 1, 120 ).unwrap(); connection.ping() .and_then(|_| Ok(println!("Connected!")));
impl Docker
[src]
pub fn chain(self) -> DockerChain
[src]
Create a chain of docker commands, useful to calling the API in a sequential manner.
Examples
use bollard::Docker; let docker = Docker::connect_with_http_defaults().unwrap(); docker.chain();
impl Docker
[src]
pub fn create_exec<T>(
&self,
container_name: &str,
config: CreateExecOptions<T>
) -> impl Future<Item = CreateExecResults, Error = Error> where
T: AsRef<str> + Serialize,
[src]
&self,
container_name: &str,
config: CreateExecOptions<T>
) -> impl Future<Item = CreateExecResults, Error = Error> where
T: AsRef<str> + Serialize,
Create Exec
Run a command inside a running container.
Arguments
- Container name as string slice.
- Create Exec Options struct.
Returns
- A Create Exec Results struct, wrapped in a Future.
Examples
use bollard::exec::CreateExecOptions; use std::default::Default; let config = CreateExecOptions { cmd: Some(vec!["ps", "-ef"]), attach_stdout: Some(true), ..Default::default() }; docker.create_exec("hello-world", config);
pub fn start_exec(
&self,
container_name: &str,
config: Option<StartExecOptions>
) -> impl Stream<Item = StartExecResults, Error = Error>
[src]
&self,
container_name: &str,
config: Option<StartExecOptions>
) -> impl Stream<Item = StartExecResults, Error = Error>
Start Exec
Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command.
Arguments
- Container name as string slice.
Returns
- Log Output enum, wrapped in a Stream.
Examples
use bollard::exec::StartExecOptions; docker.start_exec("hello-world", None::<StartExecOptions>);
pub fn inspect_exec(
&self,
container_name: &str
) -> impl Future<Item = ExecInspect, Error = Error>
[src]
&self,
container_name: &str
) -> impl Future<Item = ExecInspect, Error = Error>
Inspect Exec
Return low-level information about an exec instance.
Arguments
- Container name as string slice.
Returns
- An ExecInspect struct, wrapped in a Future.
Examples
docker.inspect_exec("hello-world");
impl Docker
[src]
pub fn list_images<T, K>(
&self,
options: Option<T>
) -> impl Future<Item = Vec<APIImages>, Error = Error> where
T: ListImagesQueryParams<K>,
K: AsRef<str>,
[src]
&self,
options: Option<T>
) -> impl Future<Item = Vec<APIImages>, Error = Error> where
T: ListImagesQueryParams<K>,
K: AsRef<str>,
List Images
Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image
Arguments
- An optional List Images Options struct.
Returns
- Vector of API Images, wrapped in a Future.
Examples
use bollard::image::ListImagesOptions; use std::collections::HashMap; use std::default::Default; let mut filters = HashMap::new(); filters.insert("dangling", vec!["true"]); let options = Some(ListImagesOptions{ all: true, filters: filters, ..Default::default() }); docker.list_images(options);
pub fn create_image<T, K, V>(
&self,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Stream<Item = CreateImageResults, Error = Error> where
T: CreateImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Stream<Item = CreateImageResults, Error = Error> where
T: CreateImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Create Image
Create an image by either pulling it from a registry or importing it.
Arguments
- An optional Create Image Options struct.
Returns
- Create Image Results, wrapped in an asynchronous Stream.
Examples
use bollard::image::CreateImageOptions; use std::default::Default; let options = Some(CreateImageOptions{ from_image: "hello-world", ..Default::default() }); docker.create_image(options, None); // do some other work while the image is pulled from the docker hub...
Unsupported
- Import from tarball
pub fn inspect_image(
&self,
image_name: &str
) -> impl Future<Item = Image, Error = Error>
[src]
&self,
image_name: &str
) -> impl Future<Item = Image, Error = Error>
Inspect Image
Return low-level information about an image.
Arguments
- Image name as a string slice.
Returns
- Image, wrapped in a Future.
Examples
use std::default::Default; docker.inspect_image("hello-world");
pub fn prune_images<T, K>(
&self,
options: Option<T>
) -> impl Future<Item = PruneImagesResults, Error = Error> where
T: PruneImagesQueryParams<K>,
K: AsRef<str>,
[src]
&self,
options: Option<T>
) -> impl Future<Item = PruneImagesResults, Error = Error> where
T: PruneImagesQueryParams<K>,
K: AsRef<str>,
Prune Images
Delete unused images.
Arguments
- An optional Prune Images Options struct.
Returns
- a Prune Images Results, wrapped in a Future.
Examples
use bollard::image::PruneImagesOptions; use std::collections::HashMap; let mut filters = HashMap::new(); filters.insert("until", vec!["10m"]); let options = Some(PruneImagesOptions { filters: filters }); docker.prune_images(options);
pub fn image_history(
&self,
image_name: &str
) -> impl Future<Item = Vec<ImageHistory>, Error = Error>
[src]
&self,
image_name: &str
) -> impl Future<Item = Vec<ImageHistory>, Error = Error>
Image History
Return parent layers of an image.
Arguments
- Image name as a string slice.
Returns
- Vector of Image History Results, wrapped in a Future.
Examples
docker.image_history("hello-world");
pub fn search_images<T, K>(
&self,
options: T
) -> impl Future<Item = Vec<APIImageSearch>, Error = Error> where
T: SearchImagesQueryParams<K>,
K: AsRef<str>,
[src]
&self,
options: T
) -> impl Future<Item = Vec<APIImageSearch>, Error = Error> where
T: SearchImagesQueryParams<K>,
K: AsRef<str>,
Search Images
Search for an image on Docker Hub.
Arguments
- Search Image Options struct.
Returns
- Vector of API Image Search results, wrapped in a Future.
Examples
use bollard::image::SearchImagesOptions; use std::default::Default; use std::collections::HashMap; let mut filters = HashMap::new(); filters.insert("until", "10m"); let search_options = SearchImagesOptions { term: "hello-world", filters: filters, ..Default::default() }; docker.search_images(search_options);
pub fn remove_image<T, K, V>(
&self,
image_name: &str,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Future<Item = Vec<RemoveImageResults>, Error = Error> where
T: RemoveImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
image_name: &str,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Future<Item = Vec<RemoveImageResults>, Error = Error> where
T: RemoveImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Remove Image
Remove an image, along with any untagged parent images that were referenced by that image.
Arguments
- Image name as a string slice.
- An optional Remove Image Options struct.
Returns
- Vector of Remove Image Results, wrapped in a Future.
Examples
use bollard::image::RemoveImageOptions; use std::default::Default; let remove_options = Some(RemoveImageOptions { force: true, ..Default::default() }); docker.remove_image("hello-world", remove_options, None);
pub fn tag_image<T, K, V>(
&self,
image_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: TagImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
image_name: &str,
options: Option<T>
) -> impl Future<Item = (), Error = Error> where
T: TagImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Tag Image
Tag an image so that it becomes part of a repository.
Arguments
- Image name as a string slice.
- Optional Tag Image Options struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::image::TagImageOptions; use std::default::Default; let tag_options = Some(TagImageOptions { tag: "v1.0.1", ..Default::default() }); docker.tag_image("hello-world", tag_options);
pub fn push_image<T, K, V>(
&self,
image_name: &str,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Future<Item = (), Error = Error> where
T: PushImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
[src]
&self,
image_name: &str,
options: Option<T>,
credentials: Option<DockerCredentials>
) -> impl Future<Item = (), Error = Error> where
T: PushImageQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Push Image
Push an image to a registry.
Arguments
- Image name as a string slice.
- Optional Push Image Options struct.
- Optional Docker Credentials struct.
Returns
- unit type
()
, wrapped in a Future.
Examples
use bollard::auth::DockerCredentials; use bollard::image::PushImageOptions; use std::default::Default; let push_options = Some(PushImageOptions { tag: "v1.0.1", }); let credentials = Some(DockerCredentials { username: Some("Jack".to_string()), password: Some("myverysecretpassword".to_string()), ..Default::default() }); docker.push_image("hello-world", push_options, credentials);
pub fn commit_container<T, K, V, Z>(
&self,
options: T,
config: Config<Z>
) -> impl Future<Item = CommitContainerResults, Error = Error> where
T: CommitContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Z: AsRef<str> + Eq + Hash + Serialize,
[src]
&self,
options: T,
config: Config<Z>
) -> impl Future<Item = CommitContainerResults, Error = Error> where
T: CommitContainerQueryParams<K, V>,
K: AsRef<str>,
V: AsRef<str>,
Z: AsRef<str> + Eq + Hash + Serialize,
Commit Container
Create a new image from a container.
Arguments
- Commit Container Options struct.
- Container Config struct.
Returns
- Commit Container Results, wrapped in a Future.
Examples
use bollard::image::CommitContainerOptions; use bollard::container::Config; use std::default::Default; let options = CommitContainerOptions{ container: "my-running-container", pause: true, ..Default::default() }; let config = Config::<String> { ..Default::default() }; docker.commit_container(options, config);
pub fn build_image<T, K>(
&self,
options: T,
credentials: Option<HashMap<String, DockerCredentials>>,
tar: Option<Body>
) -> impl Stream<Item = BuildImageResults, Error = Error> where
T: BuildImageQueryParams<K>,
K: AsRef<str>,
[src]
&self,
options: T,
credentials: Option<HashMap<String, DockerCredentials>>,
tar: Option<Body>
) -> impl Stream<Item = BuildImageResults, Error = Error> where
T: BuildImageQueryParams<K>,
K: AsRef<str>,
Build Image
Build an image from a tar archive with a Dockerfile
in it.
The Dockerfile
specifies how the image is built from the tar archive. It is typically in
the archive's root, but can be at a different path or have a different name by specifying
the dockerfile
parameter.
Arguments
- Build Image Options struct.
- Optional Docker Credentials struct.
- Tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. Optional Hyper Body.
Returns
- Build Image Results, wrapped in an asynchronous Stream.
Examples
use bollard::image::BuildImageOptions; use bollard::container::Config; use std::default::Default; use std::fs::File; use std::io::Read; let options = BuildImageOptions{ dockerfile: "Dockerfile", t: "my-image", rm: true, ..Default::default() }; let mut file = File::open("tarball.tar.gz").unwrap(); let mut contents = Vec::new(); file.read_to_end(&mut contents).unwrap(); docker.build_image(options, None, Some(contents.into()));
impl Docker
[src]
pub fn version(&self) -> impl Future<Item = Version, Error = Error>
[src]
Version
Returns the version of Docker that is running and various information about the system that Docker is running on.
Returns
- Version, wrapped in a Future.
Examples
docker.version();
pub fn ping(&self) -> impl Future<Item = String, Error = Error>
[src]
Trait Implementations
impl Clone for Docker
[src]
fn clone(&self) -> Docker
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Docker
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,