mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-22 17:19:06 +01:00
- Implemented GetContainer function to retrieve container details by ID. - Introduced idDockerHostMap for mapping container IDs to Docker hosts. - Updated Container struct to allow omitting the State field in JSON responses.
20 lines
376 B
Go
20 lines
376 B
Go
package docker
|
|
|
|
import (
|
|
"github.com/puzpuzpuz/xsync/v4"
|
|
)
|
|
|
|
var idDockerHostMap = xsync.NewMap[string, string]()
|
|
|
|
func GetDockerHostByContainerID(id string) (string, bool) {
|
|
return idDockerHostMap.Load(id)
|
|
}
|
|
|
|
func SetDockerHostByContainerID(id, host string) {
|
|
idDockerHostMap.Store(id, host)
|
|
}
|
|
|
|
func DeleteDockerHostByContainerID(id string) {
|
|
idDockerHostMap.Delete(id)
|
|
}
|