environment(docker): fix podman compatibility (#151)

This commit is contained in:
Matthew Penner
2022-11-06 13:33:01 -07:00
committed by GitHub
parent f577f5521f
commit 3337362955
10 changed files with 95 additions and 115 deletions

View File

@@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"fmt"
"html/template"
"io"
"os"
@@ -419,7 +420,12 @@ func (ip *InstallationProcess) Execute() (string, error) {
},
}
tmpfsSize := strconv.Itoa(int(config.Get().Docker.TmpfsSize))
cfg := config.Get()
if cfg.System.User.Rootless.Enabled {
conf.User = fmt.Sprintf("%d:%d", cfg.System.User.Rootless.ContainerUID, cfg.System.User.Rootless.ContainerGID)
}
tmpfsSize := strconv.Itoa(int(cfg.Docker.TmpfsSize))
hostConf := &container.HostConfig{
Mounts: []mount.Mount{
{
@@ -439,18 +445,11 @@ func (ip *InstallationProcess) Execute() (string, error) {
Tmpfs: map[string]string{
"/tmp": "rw,exec,nosuid,size=" + tmpfsSize + "M",
},
DNS: config.Get().Docker.Network.Dns,
LogConfig: container.LogConfig{
Type: "local",
Config: map[string]string{
"max-size": "5m",
"max-file": "1",
"compress": "false",
},
},
DNS: cfg.Docker.Network.Dns,
LogConfig: cfg.Docker.ContainerLogConfig(),
Privileged: true,
NetworkMode: container.NetworkMode(config.Get().Docker.Network.Mode),
UsernsMode: container.UsernsMode(config.Get().Docker.UsernsMode),
NetworkMode: container.NetworkMode(cfg.Docker.Network.Mode),
UsernsMode: container.UsernsMode(cfg.Docker.UsernsMode),
}
// Ensure the root directory for the server exists properly before attempting