Skip to content

Commit

Permalink
Merge pull request #188 from davenverse/labels
Browse files Browse the repository at this point in the history
Add Labels to Create Container
  • Loading branch information
ChristopherDavenport authored Dec 24, 2021
2 parents 47a7c54 + dd9d802 commit 41c04a9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ object Containers {
image: String,
exposedPorts: Map[Int, Option[Int]] = Map.empty, // Container Port, Host Port (None binds random)
env: Map[String, String] = Map.empty,
labels: Map[String, String] = Map.empty,
baseUri: Uri = Docker.versionPrefix
): F[Data.ContainerCreated] = {
val req = Request[F](Method.POST, containersPrefix(baseUri) / "create")
.withEntity{
Json.obj(
"Image" -> image.asJson,
"Labels" -> Json.obj(
labels.mapValues(Json.fromString(_)).toSeq:_*
),
"ExposedPorts" -> Json.obj(
exposedPorts.toList.map{ case (i, _) => s"$i/tcp" -> Json.obj()}:_*
),
Expand Down

0 comments on commit 41c04a9

Please sign in to comment.