From 6cc9109486dd5a2a9425bf72b557114a5dcd25eb Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Tue, 12 Mar 2024 15:43:44 +0000 Subject: [PATCH] feat: allow to set the cgroup parent for container It is already possible to set this to the image builder but not to the container. --- internal/provider/resource_docker_container.go | 6 ++++++ internal/provider/resource_docker_container_funcs.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/internal/provider/resource_docker_container.go b/internal/provider/resource_docker_container.go index 4682a35f7..a9f5a4600 100644 --- a/internal/provider/resource_docker_container.go +++ b/internal/provider/resource_docker_container.go @@ -957,6 +957,12 @@ func resourceDockerContainer() *schema.Resource { Optional: true, ForceNew: true, }, + "cgroup_parent": { + Type: schema.TypeString, + Description: "Optional parent cgroup for the container", + Optional: true, + ForceNew: true, + }, }, } } diff --git a/internal/provider/resource_docker_container_funcs.go b/internal/provider/resource_docker_container_funcs.go index f51ce0c80..3b3d4936b 100644 --- a/internal/provider/resource_docker_container_funcs.go +++ b/internal/provider/resource_docker_container_funcs.go @@ -371,6 +371,10 @@ func resourceDockerContainerCreate(ctx context.Context, d *schema.ResourceData, } } + if v, ok := d.GetOk("cgroupns_mode"); ok { + hostConfig.CgroupParent = v.(string) + } + init := d.Get("init").(bool) hostConfig.Init = &init