mirror of
https://github.com/docker/compose.git
synced 2025-07-21 20:54:32 +02:00
Merge pull request #9385 from ndeloof/lowercase_project_name
project name MUST be lowercase
This commit is contained in:
commit
a32fdff979
@ -32,9 +32,9 @@ type Service interface {
|
|||||||
// Push executes the equivalent ot a `compose push`
|
// Push executes the equivalent ot a `compose push`
|
||||||
Push(ctx context.Context, project *types.Project, options PushOptions) error
|
Push(ctx context.Context, project *types.Project, options PushOptions) error
|
||||||
// Pull executes the equivalent of a `compose pull`
|
// Pull executes the equivalent of a `compose pull`
|
||||||
Pull(ctx context.Context, project *types.Project, opts PullOptions) error
|
Pull(ctx context.Context, project *types.Project, options PullOptions) error
|
||||||
// Create executes the equivalent to a `compose create`
|
// Create executes the equivalent to a `compose create`
|
||||||
Create(ctx context.Context, project *types.Project, opts CreateOptions) error
|
Create(ctx context.Context, project *types.Project, options CreateOptions) error
|
||||||
// Start executes the equivalent to a `compose start`
|
// Start executes the equivalent to a `compose start`
|
||||||
Start(ctx context.Context, projectName string, options StartOptions) error
|
Start(ctx context.Context, projectName string, options StartOptions) error
|
||||||
// Restart restarts containers
|
// Restart restarts containers
|
||||||
@ -54,25 +54,25 @@ type Service interface {
|
|||||||
// Convert translate compose model into backend's native format
|
// Convert translate compose model into backend's native format
|
||||||
Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
|
Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
|
||||||
// Kill executes the equivalent to a `compose kill`
|
// Kill executes the equivalent to a `compose kill`
|
||||||
Kill(ctx context.Context, project string, options KillOptions) error
|
Kill(ctx context.Context, projectName string, options KillOptions) error
|
||||||
// RunOneOffContainer creates a service oneoff container and starts its dependencies
|
// RunOneOffContainer creates a service oneoff container and starts its dependencies
|
||||||
RunOneOffContainer(ctx context.Context, project *types.Project, opts RunOptions) (int, error)
|
RunOneOffContainer(ctx context.Context, project *types.Project, opts RunOptions) (int, error)
|
||||||
// Remove executes the equivalent to a `compose rm`
|
// Remove executes the equivalent to a `compose rm`
|
||||||
Remove(ctx context.Context, project string, options RemoveOptions) error
|
Remove(ctx context.Context, projectName string, options RemoveOptions) error
|
||||||
// Exec executes a command in a running service container
|
// Exec executes a command in a running service container
|
||||||
Exec(ctx context.Context, project string, opts RunOptions) (int, error)
|
Exec(ctx context.Context, projectName string, options RunOptions) (int, error)
|
||||||
// Copy copies a file/folder between a service container and the local filesystem
|
// Copy copies a file/folder between a service container and the local filesystem
|
||||||
Copy(ctx context.Context, project string, options CopyOptions) error
|
Copy(ctx context.Context, projectName string, options CopyOptions) error
|
||||||
// Pause executes the equivalent to a `compose pause`
|
// Pause executes the equivalent to a `compose pause`
|
||||||
Pause(ctx context.Context, project string, options PauseOptions) error
|
Pause(ctx context.Context, projectName string, options PauseOptions) error
|
||||||
// UnPause executes the equivalent to a `compose unpause`
|
// UnPause executes the equivalent to a `compose unpause`
|
||||||
UnPause(ctx context.Context, project string, options PauseOptions) error
|
UnPause(ctx context.Context, projectName string, options PauseOptions) error
|
||||||
// Top executes the equivalent to a `compose top`
|
// Top executes the equivalent to a `compose top`
|
||||||
Top(ctx context.Context, projectName string, services []string) ([]ContainerProcSummary, error)
|
Top(ctx context.Context, projectName string, services []string) ([]ContainerProcSummary, error)
|
||||||
// Events executes the equivalent to a `compose events`
|
// Events executes the equivalent to a `compose events`
|
||||||
Events(ctx context.Context, project string, options EventsOptions) error
|
Events(ctx context.Context, projectName string, options EventsOptions) error
|
||||||
// Port executes the equivalent to a `compose port`
|
// Port executes the equivalent to a `compose port`
|
||||||
Port(ctx context.Context, project string, service string, port int, options PortOptions) (string, int, error)
|
Port(ctx context.Context, projectName string, service string, port int, options PortOptions) (string, int, error)
|
||||||
// Images executes the equivalent of a `compose images`
|
// Images executes the equivalent of a `compose images`
|
||||||
Images(ctx context.Context, projectName string, options ImagesOptions) ([]ImageSummary, error)
|
Images(ctx context.Context, projectName string, options ImagesOptions) ([]ImageSummary, error)
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,11 @@ func (s *ServiceProxy) Convert(ctx context.Context, project *types.Project, opti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Kill implements Service interface
|
// Kill implements Service interface
|
||||||
func (s *ServiceProxy) Kill(ctx context.Context, project string, options KillOptions) error {
|
func (s *ServiceProxy) Kill(ctx context.Context, projectName string, options KillOptions) error {
|
||||||
if s.KillFn == nil {
|
if s.KillFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.KillFn(ctx, project, options)
|
return s.KillFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunOneOffContainer implements Service interface
|
// RunOneOffContainer implements Service interface
|
||||||
@ -238,43 +238,43 @@ func (s *ServiceProxy) RunOneOffContainer(ctx context.Context, project *types.Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove implements Service interface
|
// Remove implements Service interface
|
||||||
func (s *ServiceProxy) Remove(ctx context.Context, project string, options RemoveOptions) error {
|
func (s *ServiceProxy) Remove(ctx context.Context, projectName string, options RemoveOptions) error {
|
||||||
if s.RemoveFn == nil {
|
if s.RemoveFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.RemoveFn(ctx, project, options)
|
return s.RemoveFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec implements Service interface
|
// Exec implements Service interface
|
||||||
func (s *ServiceProxy) Exec(ctx context.Context, project string, options RunOptions) (int, error) {
|
func (s *ServiceProxy) Exec(ctx context.Context, projectName string, options RunOptions) (int, error) {
|
||||||
if s.ExecFn == nil {
|
if s.ExecFn == nil {
|
||||||
return 0, ErrNotImplemented
|
return 0, ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.ExecFn(ctx, project, options)
|
return s.ExecFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy implements Service interface
|
// Copy implements Service interface
|
||||||
func (s *ServiceProxy) Copy(ctx context.Context, project string, options CopyOptions) error {
|
func (s *ServiceProxy) Copy(ctx context.Context, projectName string, options CopyOptions) error {
|
||||||
if s.CopyFn == nil {
|
if s.CopyFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.CopyFn(ctx, project, options)
|
return s.CopyFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause implements Service interface
|
// Pause implements Service interface
|
||||||
func (s *ServiceProxy) Pause(ctx context.Context, project string, options PauseOptions) error {
|
func (s *ServiceProxy) Pause(ctx context.Context, projectName string, options PauseOptions) error {
|
||||||
if s.PauseFn == nil {
|
if s.PauseFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.PauseFn(ctx, project, options)
|
return s.PauseFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnPause implements Service interface
|
// UnPause implements Service interface
|
||||||
func (s *ServiceProxy) UnPause(ctx context.Context, project string, options PauseOptions) error {
|
func (s *ServiceProxy) UnPause(ctx context.Context, projectName string, options PauseOptions) error {
|
||||||
if s.UnPauseFn == nil {
|
if s.UnPauseFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.UnPauseFn(ctx, project, options)
|
return s.UnPauseFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top implements Service interface
|
// Top implements Service interface
|
||||||
@ -286,19 +286,19 @@ func (s *ServiceProxy) Top(ctx context.Context, project string, services []strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Events implements Service interface
|
// Events implements Service interface
|
||||||
func (s *ServiceProxy) Events(ctx context.Context, project string, options EventsOptions) error {
|
func (s *ServiceProxy) Events(ctx context.Context, projectName string, options EventsOptions) error {
|
||||||
if s.EventsFn == nil {
|
if s.EventsFn == nil {
|
||||||
return ErrNotImplemented
|
return ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.EventsFn(ctx, project, options)
|
return s.EventsFn(ctx, projectName, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port implements Service interface
|
// Port implements Service interface
|
||||||
func (s *ServiceProxy) Port(ctx context.Context, project string, service string, port int, options PortOptions) (string, int, error) {
|
func (s *ServiceProxy) Port(ctx context.Context, projectName string, service string, port int, options PortOptions) (string, int, error) {
|
||||||
if s.PortFn == nil {
|
if s.PortFn == nil {
|
||||||
return "", 0, ErrNotImplemented
|
return "", 0, ErrNotImplemented
|
||||||
}
|
}
|
||||||
return s.PortFn(ctx, project, service, port, options)
|
return s.PortFn(ctx, projectName, service, port, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Images implements Service interface
|
// Images implements Service interface
|
||||||
|
@ -42,9 +42,10 @@ const (
|
|||||||
acrossServices = fromService | toService
|
acrossServices = fromService | toService
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Copy(ctx context.Context, project string, opts api.CopyOptions) error {
|
func (s *composeService) Copy(ctx context.Context, projectName string, options api.CopyOptions) error {
|
||||||
srcService, srcPath := splitCpArg(opts.Source)
|
projectName = strings.ToLower(projectName)
|
||||||
destService, dstPath := splitCpArg(opts.Destination)
|
srcService, srcPath := splitCpArg(options.Source)
|
||||||
|
destService, dstPath := splitCpArg(options.Destination)
|
||||||
|
|
||||||
var direction copyDirection
|
var direction copyDirection
|
||||||
var serviceName string
|
var serviceName string
|
||||||
@ -53,7 +54,7 @@ func (s *composeService) Copy(ctx context.Context, project string, opts api.Copy
|
|||||||
serviceName = srcService
|
serviceName = srcService
|
||||||
|
|
||||||
// copying from multiple containers of a services doesn't make sense.
|
// copying from multiple containers of a services doesn't make sense.
|
||||||
if opts.All {
|
if options.All {
|
||||||
return errors.New("cannot use the --all flag when copying from a service")
|
return errors.New("cannot use the --all flag when copying from a service")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ func (s *composeService) Copy(ctx context.Context, project string, opts api.Copy
|
|||||||
serviceName = destService
|
serviceName = destService
|
||||||
}
|
}
|
||||||
|
|
||||||
containers, err := s.getContainers(ctx, project, oneOffExclude, true, serviceName)
|
containers, err := s.getContainers(ctx, projectName, oneOffExclude, true, serviceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -71,8 +72,8 @@ func (s *composeService) Copy(ctx context.Context, project string, opts api.Copy
|
|||||||
return fmt.Errorf("no container found for service %q", serviceName)
|
return fmt.Errorf("no container found for service %q", serviceName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !opts.All {
|
if !options.All {
|
||||||
containers = containers.filter(indexed(opts.Index))
|
containers = containers.filter(indexed(options.Index))
|
||||||
}
|
}
|
||||||
|
|
||||||
g := errgroup.Group{}
|
g := errgroup.Group{}
|
||||||
@ -81,9 +82,9 @@ func (s *composeService) Copy(ctx context.Context, project string, opts api.Copy
|
|||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
switch direction {
|
switch direction {
|
||||||
case fromService:
|
case fromService:
|
||||||
return s.copyFromContainer(ctx, containerID, srcPath, dstPath, opts)
|
return s.copyFromContainer(ctx, containerID, srcPath, dstPath, options)
|
||||||
case toService:
|
case toService:
|
||||||
return s.copyToContainer(ctx, containerID, srcPath, dstPath, opts)
|
return s.copyToContainer(ctx, containerID, srcPath, dstPath, options)
|
||||||
case acrossServices:
|
case acrossServices:
|
||||||
return errors.New("copying between services is not supported")
|
return errors.New("copying between services is not supported")
|
||||||
default:
|
default:
|
||||||
|
@ -29,9 +29,10 @@ import (
|
|||||||
"github.com/docker/compose/v2/pkg/utils"
|
"github.com/docker/compose/v2/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Events(ctx context.Context, project string, options api.EventsOptions) error {
|
func (s *composeService) Events(ctx context.Context, projectName string, options api.EventsOptions) error {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
events, errors := s.apiClient().Events(ctx, moby.EventsOptions{
|
events, errors := s.apiClient().Events(ctx, moby.EventsOptions{
|
||||||
Filters: filters.NewArgs(projectFilter(project)),
|
Filters: filters.NewArgs(projectFilter(projectName)),
|
||||||
})
|
})
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -19,6 +19,7 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
"github.com/docker/cli/cli/command/container"
|
"github.com/docker/cli/cli/command/container"
|
||||||
@ -27,22 +28,23 @@ import (
|
|||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Exec(ctx context.Context, project string, opts api.RunOptions) (int, error) {
|
func (s *composeService) Exec(ctx context.Context, projectName string, options api.RunOptions) (int, error) {
|
||||||
target, err := s.getExecTarget(ctx, project, opts)
|
projectName = strings.ToLower(projectName)
|
||||||
|
target, err := s.getExecTarget(ctx, projectName, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
exec := container.NewExecOptions()
|
exec := container.NewExecOptions()
|
||||||
exec.Interactive = opts.Interactive
|
exec.Interactive = options.Interactive
|
||||||
exec.TTY = opts.Tty
|
exec.TTY = options.Tty
|
||||||
exec.Detach = opts.Detach
|
exec.Detach = options.Detach
|
||||||
exec.User = opts.User
|
exec.User = options.User
|
||||||
exec.Privileged = opts.Privileged
|
exec.Privileged = options.Privileged
|
||||||
exec.Workdir = opts.WorkingDir
|
exec.Workdir = options.WorkingDir
|
||||||
exec.Container = target.ID
|
exec.Container = target.ID
|
||||||
exec.Command = opts.Command
|
exec.Command = options.Command
|
||||||
for _, v := range opts.Environment {
|
for _, v := range options.Environment {
|
||||||
err := exec.Env.Set(v)
|
err := exec.Env.Set(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Images(ctx context.Context, projectName string, options api.ImagesOptions) ([]api.ImageSummary, error) {
|
func (s *composeService) Images(ctx context.Context, projectName string, options api.ImagesOptions) ([]api.ImageSummary, error) {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
allContainers, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
allContainers, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
||||||
All: true,
|
All: true,
|
||||||
Filters: filters.NewArgs(projectFilter(projectName)),
|
Filters: filters.NewArgs(projectFilter(projectName)),
|
||||||
|
@ -19,6 +19,7 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
moby "github.com/docker/docker/api/types"
|
moby "github.com/docker/docker/api/types"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@ -27,19 +28,19 @@ import (
|
|||||||
"github.com/docker/compose/v2/pkg/progress"
|
"github.com/docker/compose/v2/pkg/progress"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Kill(ctx context.Context, project string, options api.KillOptions) error {
|
func (s *composeService) Kill(ctx context.Context, projectName string, options api.KillOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.kill(ctx, project, options)
|
return s.kill(ctx, strings.ToLower(projectName), options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) kill(ctx context.Context, project string, options api.KillOptions) error {
|
func (s *composeService) kill(ctx context.Context, projectName string, options api.KillOptions) error {
|
||||||
w := progress.ContextWriter(ctx)
|
w := progress.ContextWriter(ctx)
|
||||||
|
|
||||||
services := options.Services
|
services := options.Services
|
||||||
|
|
||||||
var containers Containers
|
var containers Containers
|
||||||
containers, err := s.getContainers(ctx, project, oneOffInclude, false, services...)
|
containers, err := s.getContainers(ctx, projectName, oneOffInclude, false, services...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
"github.com/docker/compose/v2/pkg/utils"
|
"github.com/docker/compose/v2/pkg/utils"
|
||||||
@ -28,6 +29,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Logs(ctx context.Context, projectName string, consumer api.LogConsumer, options api.LogOptions) error {
|
func (s *composeService) Logs(ctx context.Context, projectName string, consumer api.LogConsumer, options api.LogOptions) error {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
containers, err := s.getContainers(ctx, projectName, oneOffExclude, true, options.Services...)
|
containers, err := s.getContainers(ctx, projectName, oneOffExclude, true, options.Services...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -18,6 +18,7 @@ package compose
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
moby "github.com/docker/docker/api/types"
|
moby "github.com/docker/docker/api/types"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@ -26,9 +27,9 @@ import (
|
|||||||
"github.com/docker/compose/v2/pkg/progress"
|
"github.com/docker/compose/v2/pkg/progress"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Pause(ctx context.Context, project string, options api.PauseOptions) error {
|
func (s *composeService) Pause(ctx context.Context, projectName string, options api.PauseOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.pause(ctx, project, options)
|
return s.pause(ctx, strings.ToLower(projectName), options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,14 +55,14 @@ func (s *composeService) pause(ctx context.Context, project string, options api.
|
|||||||
return eg.Wait()
|
return eg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) UnPause(ctx context.Context, project string, options api.PauseOptions) error {
|
func (s *composeService) UnPause(ctx context.Context, projectName string, options api.PauseOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.unPause(ctx, project, options)
|
return s.unPause(ctx, strings.ToLower(projectName), options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) unPause(ctx context.Context, project string, options api.PauseOptions) error {
|
func (s *composeService) unPause(ctx context.Context, projectName string, options api.PauseOptions) error {
|
||||||
containers, err := s.getContainers(ctx, project, oneOffExclude, false, options.Services...)
|
containers, err := s.getContainers(ctx, projectName, oneOffExclude, false, options.Services...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
|
|
||||||
@ -26,10 +27,11 @@ import (
|
|||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Port(ctx context.Context, project string, service string, port int, options api.PortOptions) (string, int, error) {
|
func (s *composeService) Port(ctx context.Context, projectName string, service string, port int, options api.PortOptions) (string, int, error) {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
list, err := s.apiClient().ContainerList(ctx, moby.ContainerListOptions{
|
||||||
Filters: filters.NewArgs(
|
Filters: filters.NewArgs(
|
||||||
projectFilter(project),
|
projectFilter(projectName),
|
||||||
serviceFilter(service),
|
serviceFilter(service),
|
||||||
containerNumberFilter(options.Index),
|
containerNumberFilter(options.Index),
|
||||||
),
|
),
|
||||||
|
@ -19,6 +19,7 @@ package compose
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Ps(ctx context.Context, projectName string, options api.PsOptions) ([]api.ContainerSummary, error) {
|
func (s *composeService) Ps(ctx context.Context, projectName string, options api.PsOptions) ([]api.ContainerSummary, error) {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
oneOff := oneOffExclude
|
oneOff := oneOffExclude
|
||||||
if options.All {
|
if options.All {
|
||||||
oneOff = oneOffInclude
|
oneOff = oneOffInclude
|
||||||
|
@ -36,12 +36,12 @@ import (
|
|||||||
"github.com/docker/compose/v2/pkg/progress"
|
"github.com/docker/compose/v2/pkg/progress"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Pull(ctx context.Context, project *types.Project, opts api.PullOptions) error {
|
func (s *composeService) Pull(ctx context.Context, project *types.Project, options api.PullOptions) error {
|
||||||
if opts.Quiet {
|
if options.Quiet {
|
||||||
return s.pull(ctx, project, opts)
|
return s.pull(ctx, project, options)
|
||||||
}
|
}
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.pull(ctx, project, opts)
|
return s.pull(ctx, project, options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Remove(ctx context.Context, projectName string, options api.RemoveOptions) error {
|
func (s *composeService) Remove(ctx context.Context, projectName string, options api.RemoveOptions) error {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
containers, _, err := s.actualState(ctx, projectName, options.Services)
|
containers, _, err := s.actualState(ctx, projectName, options.Services)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if api.IsNotFoundError(err) {
|
if api.IsNotFoundError(err) {
|
||||||
|
@ -18,6 +18,7 @@ package compose
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@ -28,7 +29,7 @@ import (
|
|||||||
|
|
||||||
func (s *composeService) Restart(ctx context.Context, projectName string, options api.RestartOptions) error {
|
func (s *composeService) Restart(ctx context.Context, projectName string, options api.RestartOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.restart(ctx, projectName, options)
|
return s.restart(ctx, strings.ToLower(projectName), options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package compose
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
moby "github.com/docker/docker/api/types"
|
moby "github.com/docker/docker/api/types"
|
||||||
@ -30,7 +31,7 @@ import (
|
|||||||
|
|
||||||
func (s *composeService) Start(ctx context.Context, projectName string, options api.StartOptions) error {
|
func (s *composeService) Start(ctx context.Context, projectName string, options api.StartOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.start(ctx, projectName, options, nil)
|
return s.start(ctx, strings.ToLower(projectName), options, nil)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package compose
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
"github.com/docker/compose/v2/pkg/progress"
|
"github.com/docker/compose/v2/pkg/progress"
|
||||||
@ -25,7 +26,7 @@ import (
|
|||||||
|
|
||||||
func (s *composeService) Stop(ctx context.Context, projectName string, options api.StopOptions) error {
|
func (s *composeService) Stop(ctx context.Context, projectName string, options api.StopOptions) error {
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
return progress.Run(ctx, func(ctx context.Context) error {
|
||||||
return s.stop(ctx, projectName, options)
|
return s.stop(ctx, strings.ToLower(projectName), options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,14 @@ package compose
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/compose/v2/pkg/api"
|
"github.com/docker/compose/v2/pkg/api"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *composeService) Top(ctx context.Context, projectName string, services []string) ([]api.ContainerProcSummary, error) {
|
func (s *composeService) Top(ctx context.Context, projectName string, services []string) ([]api.ContainerProcSummary, error) {
|
||||||
|
projectName = strings.ToLower(projectName)
|
||||||
var containers Containers
|
var containers Containers
|
||||||
containers, err := s.getContainers(ctx, projectName, oneOffInclude, false)
|
containers, err := s.getContainers(ctx, projectName, oneOffInclude, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user