diff --git a/config/config_docker.go b/config/config_docker.go index 8b942b8..fa54e32 100644 --- a/config/config_docker.go +++ b/config/config_docker.go @@ -63,6 +63,11 @@ type DockerConfiguration struct { // Registries . Registries map[string]RegistryConfiguration `json:"registries" yaml:"registries"` + + // The size of the /tmp directory when mounted into a container. Please be aware that Docker + // utilizes host memory for this value, and that we do not keep track of the space used here + // so avoid allocating too much to a server. + TmpfsSize uint `default:"100" json:"tmpfs_size" yaml:"tmpfs_size"` } // RegistryConfiguration . diff --git a/environment/docker/container.go b/environment/docker/container.go index 2369631..32b8a2f 100644 --- a/environment/docker/container.go +++ b/environment/docker/container.go @@ -148,6 +148,8 @@ func (e *Environment) Create() error { }, } + tmpfsSize := strconv.Itoa(int(config.Get().Docker.TmpfsSize)) + hostConf := &container.HostConfig{ PortBindings: a.Bindings(), @@ -158,7 +160,7 @@ func (e *Environment) Create() error { // Configure the /tmp folder mapping in containers. This is necessary for some // games that need to make use of it for downloads and other installation processes. Tmpfs: map[string]string{ - "/tmp": "rw,exec,nosuid,size=50M", + "/tmp": "rw,exec,nosuid,size="+tmpfsSize+"M", }, // Define resource limits for the container based on the data passed through diff --git a/server/install.go b/server/install.go index 4d99f20..a4f5090 100644 --- a/server/install.go +++ b/server/install.go @@ -19,6 +19,7 @@ import ( "os" "path" "path/filepath" + "strconv" "sync" "time" ) @@ -429,6 +430,7 @@ func (ip *InstallationProcess) Execute(installPath string) (string, error) { }, } + tmpfsSize := strconv.Itoa(int(config.Get().Docker.TmpfsSize)) hostConf := &container.HostConfig{ Mounts: []mount.Mount{ { @@ -445,7 +447,7 @@ func (ip *InstallationProcess) Execute(installPath string) (string, error) { }, }, Tmpfs: map[string]string{ - "/tmp": "rw,exec,nosuid,size=50M", + "/tmp": "rw,exec,nosuid,size="+tmpfsSize+"M", }, DNS: config.Get().Docker.Network.Dns, LogConfig: container.LogConfig{