Merge pull request #3046 from linxiulei/fix_shim_socket

Shorten the unix socket path for shim
This commit is contained in:
Michael Crosby
2019-03-15 09:10:47 -05:00
committed by GitHub
4 changed files with 112 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ package shim
import (
"context"
"crypto/sha256"
"fmt"
"net"
"path/filepath"
"strings"
@@ -50,7 +52,8 @@ func SocketAddress(ctx context.Context, id string) (string, error) {
if err != nil {
return "", err
}
return filepath.Join(string(filepath.Separator), "containerd-shim", ns, id, "shim.sock"), nil
d := sha256.Sum256([]byte(filepath.Join(ns, id)))
return filepath.Join(string(filepath.Separator), "containerd-shim", fmt.Sprintf("%x.sock", d)), nil
}
// AnonDialer returns a dialer for an abstract socket