MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / cloneContainerHostConfig

Function cloneContainerHostConfig

agent/app/service/backup_container.go:834–852  ·  view source on GitHub ↗
(hostConfig *container.HostConfig)

Source from the content-addressed store, hash-verified

832}
833
834func cloneContainerHostConfig(hostConfig *container.HostConfig) *container.HostConfig {
835 if hostConfig == nil {
836 return &container.HostConfig{}
837 }
838 item := *hostConfig
839 if len(hostConfig.Binds) != 0 {
840 item.Binds = append([]string(nil), hostConfig.Binds...)
841 }
842 if len(hostConfig.DNS) != 0 {
843 item.DNS = append([]string(nil), hostConfig.DNS...)
844 }
845 if len(hostConfig.ExtraHosts) != 0 {
846 item.ExtraHosts = append([]string(nil), hostConfig.ExtraHosts...)
847 }
848 if len(hostConfig.Mounts) != 0 {
849 item.Mounts = append([]mount.Mount(nil), hostConfig.Mounts...)
850 }
851 return &item
852}
853
854func stepRestoreContainerMounts(recoverCtx *containerRecoverContext) error {
855 currentContainer := recoverCtx.createdContainerID

Callers 1

stepRecreateContainerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected