DockerDotNet.Presets 1.3.0

dotnet add package DockerDotNet.Presets --version 1.3.0
                    
NuGet\Install-Package DockerDotNet.Presets -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DockerDotNet.Presets" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DockerDotNet.Presets" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="DockerDotNet.Presets" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DockerDotNet.Presets --version 1.3.0
                    
#r "nuget: DockerDotNet.Presets, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DockerDotNet.Presets@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DockerDotNet.Presets&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=DockerDotNet.Presets&version=1.3.0
                    
Install as a Cake Tool

DockerDotNet.Presets

This library is made to speed up and simplify the working experience with docker containers. It is made up on Docker.DotNet that is a really great library that exposes good api to interact with docker, but it could be a bit verbose and long to bring up containers, for this reason I built this library with a set of ready configurations to run up containers.

Installation

You can add this library to your project using NuGet.

Package Manager Console Run the following command in the “Package Manager Console”:

PM> Install-Package DockerDotNet.Presets

.NET Core Command Line Interface Run the following command from your favorite shell or terminal:

dotnet add package DockerDotNet.Presets

Usage

Create a container from a preset configuration:

using DockerDotNet.Presets;
using DockerDotNet.Presets.Configurations.Postgres;
using DockerDotNet.Presets.DTO;

DockerContainerResult containerResult = await DockerContainerGenerator.CreateContainerAsync(
        new PostgresContainerConfiguration(
            "DB_NAME",
            "DB_USER",
            "DB_PASSWORD",
            "postgres_container_name",
            "postgres_test_volume",
            "latest",
            5432
        )
    ).ConfigureAwait(false);

Drop a container by container id:

using DockerDotNet.Presets;

await DockerContainerGenerator.DropContainerById(_containerId)
    .ConfigureAwait(false);

Find a container by container id or container name:

using Docker.DotNet.Models;

using DockerDotNet.Presets;
using DockerDotNet.Presets.DTO;

ContainerListResponse? result = await DockerContainerGenerator.FindContainerAsync(
        GetDockerContainerRequest.CreateByContainerId(
            _containerId
        )
    ).ConfigureAwait(false);

If you need to create a container that is not present in this configurations you can create your own (and if it useful improve configurations of this repo) by extending abstract class: ContainerConfiguration

License

DockerDotNet.Presets is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 812 8/22/2022
1.2.0 538 7/26/2022
1.1.0 530 7/25/2022
1.0.0 540 7/24/2022