finish work
This commit is contained in:
@@ -16,6 +16,8 @@ type Create struct {
|
||||
Network string `json:"network,required"`
|
||||
Port string `json:"port,omitempty"`
|
||||
Start bool `json:"start,omitempty"`
|
||||
Volume string `json:"volume,omitzero"`
|
||||
Source string `json:"source,omitzero"`
|
||||
}
|
||||
type CreateJson struct {
|
||||
Cause string `json:"cause"`
|
||||
@@ -33,6 +35,11 @@ type create struct {
|
||||
} `json:"netns"`
|
||||
Port []PortMapping `json:"portmappings"`
|
||||
Networks map[string]NetSettings `json:"networks"`
|
||||
Volumes []VolumeMap `json:"volumes,omitzero"`
|
||||
}
|
||||
type VolumeMap struct {
|
||||
Name string `json:"name"`
|
||||
Dest string `json:"dest"`
|
||||
}
|
||||
type NetSettings struct {
|
||||
Aliases []string `json:"aliases,omitempty"`
|
||||
@@ -60,10 +67,14 @@ func (c *Create) Create() (string, error) {
|
||||
ContainerPort: port2,
|
||||
})
|
||||
}
|
||||
container.Networks = make(map[string]NetSettings)
|
||||
container.Networks["podman"] = NetSettings{
|
||||
InterfaceName: "ens0",
|
||||
if c.Source != c.Volume {
|
||||
container.Volumes = append(container.Volumes, VolumeMap{
|
||||
Name: c.Volume,
|
||||
Dest: c.Source,
|
||||
})
|
||||
}
|
||||
container.Networks = make(map[string]NetSettings)
|
||||
container.Networks["podman"] = NetSettings{}
|
||||
for k, v := range strings.Split(c.Network, ",") {
|
||||
log.Println(v)
|
||||
container.Networks[v] = NetSettings{
|
||||
|
||||
Reference in New Issue
Block a user