job := &engine.Job{ ID: "job-123", CanFail: true, Env: []string{"FOO=bar", "BAZ=qux"}, WorkingDir: "/app", }
task := engine.Task{ Path: "echo", Args: []string{"hello", "world"}, } job.Tasks = append(job.Tasks, task)
cli, _ := client.NewEnvClient() response, _ := cli.ContainerExecCreate(context.Background(), containerID, types.ExecConfig{ AttachStdout: true, AttachStderr: true, Cmd: []string{"ls", "-l"}, }) job := engine.NewJob("exec-job", response.ID, nil) engine.JobRun(job)In the above example, we are creating a job to execute a command `ls -l` on a container with `containerID`. Overall, the `engine` package is a library for building Docker tools and utilities in Go. It provides essential building blocks like job management, task management, event handling, logging, etc. for interacting with Docker engine APIs.