Default to not mounting docker socket in exec

When running `forgejo-runner exec`, default to not mounting anything in the job container instead of mounting /var/run/docker.sock. This mirrors the behavior of the docker_host config value

If mounting a docker socket in the job container is desired, the user can use --container-daemon-socket
This commit is contained in:
Andrew Cassidy 2025-10-13 23:21:15 -07:00
parent f48e9b3ba6
commit eca5e67c0b
No known key found for this signature in database
2 changed files with 1 additions and 4 deletions

View file

@ -86,9 +86,6 @@ func (c Config) GetToken() string {
}
func (c *Config) GetContainerDaemonSocket() string {
if c.ContainerDaemonSocket == "" {
return "/var/run/docker.sock"
}
return c.ContainerDaemonSocket
}

View file

@ -466,7 +466,7 @@ func loadExecCmd(ctx context.Context) *cobra.Command {
execCmd.Flags().BoolVar(&execArg.privileged, "privileged", false, "use privileged mode")
execCmd.Flags().StringVar(&execArg.usernsMode, "userns", "", "user namespace to use")
execCmd.PersistentFlags().StringVarP(&execArg.containerArchitecture, "container-architecture", "", "", "Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.")
execCmd.PersistentFlags().StringVarP(&execArg.containerDaemonSocket, "container-daemon-socket", "", "/var/run/docker.sock", "Please use the DOCKER_HOST environment variable as documented at https://forgejo.org/docs/next/admin/actions/runner-installation/#setting-up-the-container-environment instead.")
execCmd.PersistentFlags().StringVarP(&execArg.containerDaemonSocket, "container-daemon-socket", "", "-", "Please use the DOCKER_HOST environment variable as documented at https://forgejo.org/docs/next/admin/actions/runner-installation/#setting-up-the-container-environment instead.")
execCmd.Flags().BoolVar(&execArg.useGitIgnore, "use-gitignore", true, "Controls whether paths specified in .gitignore should be copied into container")
execCmd.Flags().StringArrayVarP(&execArg.containerCapAdd, "container-cap-add", "", []string{}, "kernel capabilities to add to the workflow containers (e.g. --container-cap-add SYS_PTRACE)")
execCmd.Flags().StringArrayVarP(&execArg.containerCapDrop, "container-cap-drop", "", []string{}, "kernel capabilities to remove from the workflow containers (e.g. --container-cap-drop SYS_PTRACE)")