Fix docker user and write configuration to disk when setting user

This commit is contained in:
Dane Everitt
2019-04-06 16:03:02 -07:00
parent 6e2a442846
commit 94223bafec
3 changed files with 60 additions and 12 deletions

View File

@@ -24,8 +24,8 @@ import (
type DockerEnvironment struct {
Server *Server
// The user that containers should be running as.
User string
// The user ID that containers should be running as.
User int
// Defines the configuration for the Docker instance that will allow us to connect
// and create and modify containers.
@@ -43,6 +43,7 @@ func NewDockerEnvironment(opts ...func(*DockerEnvironment)) (*DockerEnvironment,
}
env := &DockerEnvironment{
User: 1000,
Client: cli,
}
@@ -157,7 +158,7 @@ func (d *DockerEnvironment) Create() error {
conf := &container.Config{
Hostname: "container",
User: d.User,
User: strconv.Itoa(d.User),
AttachStdin: true,
AttachStdout: true,
AttachStderr: true,

View File

@@ -171,7 +171,7 @@ func FromConfiguration(data []byte, cfg *config.SystemConfiguration) (*Server, e
}
withConfiguration := func (e *DockerEnvironment) {
e.User = cfg.User
e.User = cfg.User.Uid
e.TimezonePath = cfg.TimezonePath
e.Server = s
}