fixed browsers always being created
This commit is contained in:
parent
9834ab88c8
commit
f2f0e18e6c
@ -684,6 +684,17 @@ func (con Connection) BrowseServer(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
containers, err := con.dockerClient.ContainerList(context.TODO(), container.ListOptions{Filters: filters.NewArgs(filters.Arg("label", "type=FILE_BROWSER"), filters.Arg("label", "volume_id="+serverInfo.Id))})
|
||||
if err != nil {
|
||||
ctx.AbortWithError(500, err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(containers) > 0 {
|
||||
ctx.JSON(200, "OK")
|
||||
return
|
||||
}
|
||||
|
||||
ContainerResponse, err := con.dockerClient.ContainerCreate(
|
||||
context.TODO(),
|
||||
&container.Config{
|
||||
@ -692,9 +703,8 @@ func (con Connection) BrowseServer(ctx *gin.Context) {
|
||||
Labels: browserLabels,
|
||||
},
|
||||
&container.HostConfig{
|
||||
Mounts: []mount.Mount{{Source: serverInfo.Id, Target: "/tmp/data", Type: "volume"}},
|
||||
PublishAllPorts: true,
|
||||
AutoRemove: true,
|
||||
Mounts: []mount.Mount{{Source: serverInfo.Id, Target: "/tmp/data", Type: "volume"}},
|
||||
AutoRemove: true,
|
||||
},
|
||||
&network.NetworkingConfig{
|
||||
EndpointsConfig: map[string]*network.EndpointSettings{"test": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user