mirror of https://github.com/docker/compose.git
Merge pull request #385 from docker/aci_tags
Aci improvements on tags & single container run
This commit is contained in:
commit
45a7c7a422
|
@ -71,8 +71,9 @@ func createOrUpdateACIContainers(ctx context.Context, aciContext store.AciContex
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "cannot get container group client")
|
return errors.Wrapf(err, "cannot get container group client")
|
||||||
}
|
}
|
||||||
|
groupDisplay := "Group " + *groupDefinition.Name
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: *groupDefinition.Name,
|
ID: groupDisplay,
|
||||||
Status: progress.Working,
|
Status: progress.Working,
|
||||||
StatusText: "Waiting",
|
StatusText: "Waiting",
|
||||||
})
|
})
|
||||||
|
@ -88,7 +89,7 @@ func createOrUpdateACIContainers(ctx context.Context, aciContext store.AciContex
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: *groupDefinition.Name,
|
ID: groupDisplay,
|
||||||
Status: progress.Done,
|
Status: progress.Done,
|
||||||
StatusText: "Created",
|
StatusText: "Created",
|
||||||
})
|
})
|
||||||
|
|
|
@ -42,7 +42,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
singleContainerTag = "single--container--aci"
|
singleContainerTag = "docker-single-container"
|
||||||
|
composeContainerTag = "docker-compose-application"
|
||||||
composeContainerSeparator = "_"
|
composeContainerSeparator = "_"
|
||||||
statusUnknown = "Unknown"
|
statusUnknown = "Unknown"
|
||||||
)
|
)
|
||||||
|
@ -144,7 +145,7 @@ func (cs *aciContainerService) List(ctx context.Context, _ bool) ([]containers.C
|
||||||
|
|
||||||
if _, ok := group.Tags[singleContainerTag]; ok {
|
if _, ok := group.Tags[singleContainerTag]; ok {
|
||||||
if group.Containers == nil || len(*group.Containers) < 1 {
|
if group.Containers == nil || len(*group.Containers) < 1 {
|
||||||
return []containers.Container{}, fmt.Errorf("no containers to run")
|
return []containers.Container{}, fmt.Errorf("no containers found in ACI container group %s", *containerGroup.Name)
|
||||||
}
|
}
|
||||||
container := (*group.Containers)[0]
|
container := (*group.Containers)[0]
|
||||||
c := getContainer(*containerGroup.Name, group.IPAddress, container)
|
c := getContainer(*containerGroup.Name, group.IPAddress, container)
|
||||||
|
@ -195,13 +196,16 @@ func (cs *aciContainerService) Run(ctx context.Context, r containers.ContainerCo
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
addTag(groupDefinition, singleContainerTag)
|
||||||
|
|
||||||
|
return createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||||
|
}
|
||||||
|
|
||||||
|
func addTag(groupDefinition containerinstance.ContainerGroup, tagName string) {
|
||||||
if groupDefinition.Tags == nil {
|
if groupDefinition.Tags == nil {
|
||||||
groupDefinition.Tags = make(map[string]*string, 1)
|
groupDefinition.Tags = make(map[string]*string, 1)
|
||||||
}
|
}
|
||||||
groupDefinition.Tags[singleContainerTag] = to.StringPtr("")
|
groupDefinition.Tags[tagName] = to.StringPtr("")
|
||||||
|
|
||||||
return createACIContainers(ctx, cs.ctx, groupDefinition)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *aciContainerService) Stop(ctx context.Context, containerName string, timeout *uint32) error {
|
func (cs *aciContainerService) Stop(ctx context.Context, containerName string, timeout *uint32) error {
|
||||||
|
@ -328,6 +332,7 @@ func (cs *aciComposeService) Up(ctx context.Context, opts cli.ProjectOptions) er
|
||||||
}
|
}
|
||||||
logrus.Debugf("Up on project with name %q\n", project.Name)
|
logrus.Debugf("Up on project with name %q\n", project.Name)
|
||||||
groupDefinition, err := convert.ToContainerGroup(cs.ctx, *project)
|
groupDefinition, err := convert.ToContainerGroup(cs.ctx, *project)
|
||||||
|
addTag(groupDefinition, composeContainerTag)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue