mirror of
https://github.com/docker/compose.git
synced 2025-07-27 07:34:10 +02:00
Init all the fields of a compose project at once
This commit is contained in:
parent
28808f3f6d
commit
092c432028
@ -92,8 +92,6 @@ func (cs *containerService) List(ctx context.Context) ([]containers.Container, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *containerService) Run(ctx context.Context, r containers.ContainerConfig) error {
|
func (cs *containerService) Run(ctx context.Context, r containers.ContainerConfig) error {
|
||||||
var project compose.Project
|
|
||||||
project.Name = r.ID
|
|
||||||
var ports []types.ServicePortConfig
|
var ports []types.ServicePortConfig
|
||||||
for _, p := range r.Ports {
|
for _, p := range r.Ports {
|
||||||
ports = append(ports, types.ServicePortConfig{
|
ports = append(ports, types.ServicePortConfig{
|
||||||
@ -101,11 +99,16 @@ func (cs *containerService) Run(ctx context.Context, r containers.ContainerConfi
|
|||||||
Published: p.Source,
|
Published: p.Source,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
project.Services = []types.ServiceConfig{
|
project := compose.Project{
|
||||||
{
|
Name: r.ID,
|
||||||
Name: r.ID,
|
Config: types.Config{
|
||||||
Image: r.Image,
|
Services: []types.ServiceConfig{
|
||||||
Ports: ports,
|
{
|
||||||
|
Name: r.ID,
|
||||||
|
Image: r.Image,
|
||||||
|
Ports: ports,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user