Allow starting a container with an existing hostConfig which contains links
Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
parent
9511b53907
commit
b93e4f669a
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ package parsers
|
|||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -158,5 +159,12 @@ func ParseLink(val string) (string, string, error) {
|
|||
if len(arr) == 1 {
|
||||
return val, val, nil
|
||||
}
|
||||
// This is kept because we can actually get an HostConfig with links
|
||||
// from an already created container and the format is not `foo:bar`
|
||||
// but `/foo:/c1/bar`
|
||||
if strings.HasPrefix(arr[0], "/") {
|
||||
_, alias := path.Split(arr[1])
|
||||
return arr[0][1:], alias, nil
|
||||
}
|
||||
return arr[0], arr[1], nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue