[][src]Struct testcontainers::Container

pub struct Container<'d, D, I> where
    D: 'd + Docker + 'd,
    I: Image
{ /* fields omitted */ }

Represents a running docker container.

Containers have a custom destructor that removes them as soon as they go out of scope:

#[test]
fn a_test() {
    let docker = Cli::default();

    {
        let container = docker.run(MyImage::default());

        // Docker container is stopped/removed at the end of this scope.
    }
}

Methods

impl<'d, D, I> Container<'d, D, I> where
    D: Docker,
    I: Image
[src]

Constructs a new container given an id, a docker client and the image.

This function will block the current thread (if wait_until_ready is implemented correctly) until the container is actually ready to be used.

Returns the id of this container.

Gives access to the log streams of this container.

Returns the mapped host port for an internal port of this docker container.

This method does not magically expose the given port, it simply performs a mapping on the already exposed ports. If a docker image does not expose a port, this method will not be able to resolve it.

Returns a reference to the Image of this container.

Access to this is useful if the arguments of the Image change how to connect to the Access to this is useful to retrieve Image specific information such as authentication details or other relevant information which have been passed as arguments

Trait Implementations

impl<'d, D, I> Drop for Container<'d, D, I> where
    D: Docker,
    I: Image
[src]

The destructor implementation for a Container.

As soon as the container goes out of scope, the destructor will either only stop or delete the docker container. This behaviour can be controlled through the KEEP_CONTAINERS environment variable. Setting it to true will only stop containers instead of removing them. Any other or no value will remove the container.

Executes the destructor for this type. Read more

impl<'d, D, I> Debug for Container<'d, D, I> where
    D: Debug + 'd + Docker,
    I: Debug + Image
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'d, D, I> Send for Container<'d, D, I> where
    D: Sync,
    I: Send

impl<'d, D, I> Sync for Container<'d, D, I> where
    D: Sync,
    I: Sync

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T> Same for T

Should always be Self