diff --git a/environment/container/docker/daemon.go b/environment/container/docker/daemon.go index c71cdc2d3..bcbe9fa8d 100644 --- a/environment/container/docker/daemon.go +++ b/environment/container/docker/daemon.go @@ -77,6 +77,16 @@ func (d dockerRuntime) addHostGateway(conf map[string]any) error { return nil } +func (d dockerRuntime) reloadAndRestartSystemdService() error { + if err := d.guest.Run("sudo", "systemctl", "daemon-reload"); err != nil { + return fmt.Errorf("error reloading systemd daemon: %w", err) + } + if err := d.guest.Run("sudo", "systemctl", "restart", "docker"); err != nil { + return fmt.Errorf("error restarting docker: %w", err) + } + return nil +} + const systemdUnitFilename = "/etc/systemd/system/docker.service.d/docker.conf" const systemdUnitFileContent string = ` [Service] diff --git a/environment/container/docker/docker.go b/environment/container/docker/docker.go index f9e0902b3..7d79086e0 100644 --- a/environment/container/docker/docker.go +++ b/environment/container/docker/docker.go @@ -52,6 +52,9 @@ func (d dockerRuntime) Provision(ctx context.Context) error { if err := d.addHostGateway(conf.Docker); err != nil { log.Warnln(err) } + if err := d.reloadAndRestartSystemdService(); err != nil { + log.Warnln(err) + } return nil })