mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-15 18:57:28 +08:00
Apply apparmor profile if env variable is present
This commit is contained in:
parent
dea778440e
commit
b48812b085
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
@ -181,6 +182,10 @@ func ResizeConnection(name string, cols, rows uint) error {
|
|||||||
|
|
||||||
func CreateInstance(session *Session, dindImage string) (*Instance, error) {
|
func CreateInstance(session *Session, dindImage string) (*Instance, error) {
|
||||||
h := &container.HostConfig{NetworkMode: container.NetworkMode(session.Id), Privileged: true}
|
h := &container.HostConfig{NetworkMode: container.NetworkMode(session.Id), Privileged: true}
|
||||||
|
|
||||||
|
if os.Getenv("APPARMOR_PROFILE") != "" {
|
||||||
|
h.SecurityOpt = []string{fmt.Sprintf("apparmor=%s", os.Getenv("APPARMOR_PROFILE"))}
|
||||||
|
}
|
||||||
h.Resources.PidsLimit = int64(500)
|
h.Resources.PidsLimit = int64(500)
|
||||||
h.Resources.Memory = 4092 * Megabyte
|
h.Resources.Memory = 4092 * Megabyte
|
||||||
t := true
|
t := true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user