github.com/defang-io/defang/src@v0.0.0-20240505002154-bdf411911834/pkg/docker/common.go (about)

     1  package docker
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  
     7  	"github.com/defang-io/defang/src/pkg/types"
     8  	"github.com/docker/docker/client"
     9  )
    10  
    11  type ContainerID = types.TaskID
    12  
    13  type Docker struct {
    14  	*client.Client
    15  
    16  	image    string
    17  	memory   uint64
    18  	platform string
    19  }
    20  
    21  func New() *Docker {
    22  	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
    23  	if err != nil {
    24  		panic(err)
    25  	}
    26  
    27  	return &Docker{
    28  		Client: cli,
    29  	}
    30  }
    31  
    32  var _ types.Driver = (*Docker)(nil)
    33  
    34  func (Docker) PutSecret(ctx context.Context, name, value string) error {
    35  	return errors.New("docker does not support secrets")
    36  }
    37  
    38  func (Docker) ListSecrets(ctx context.Context) ([]string, error) {
    39  	return nil, errors.New("docker does not support secrets")
    40  }
    41  
    42  func (Docker) CreateUploadURL(ctx context.Context, name string) (string, error) {
    43  	return "", errors.New("docker does not support uploads")
    44  }