github.com/sealerio/sealer@v0.11.1-0.20240507115618-f4f89c5853ae/pkg/infra/container/client/provider_interface.go (about) 1 // Copyright © 2021 Alibaba Group Holding Ltd. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package client 16 17 import ( 18 "github.com/docker/docker/api/types/mount" 19 ) 20 21 type ProviderService interface { 22 GetServerInfo() (*DockerInfo, error) 23 RunContainer(opts *CreateOptsForContainer) (string, error) 24 GetContainerInfo(containerID string, networkName string) (*Container, error) 25 RmContainer(containerID string) error 26 PullImage(imageName string) (string, error) 27 } 28 29 type Container struct { 30 ContainerID string 31 NetworkID string 32 ContainerName string 33 ContainerHostName string 34 ContainerIP string 35 Status string 36 ContainerLabel map[string]string 37 } 38 39 type CreateOptsForContainer struct { 40 ImageName string 41 NetworkName string 42 ContainerName string 43 ContainerHostName string 44 ContainerLabel map[string]string 45 Mount []mount.Mount 46 } 47 48 type DockerInfo struct { 49 CgroupDriver string 50 CgroupVersion string 51 StorageDriver string 52 MemoryLimit bool 53 PidsLimit bool 54 CPUShares bool 55 CPUNumber int 56 SecurityOptions []string 57 }