Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0458d707
Commit
0458d707
authored
Aug 10, 2015
by
peter-edge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use docker.NewClientFromEnv for creation of docker.Client
parent
e0347124
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
docker.go
pkg/kubelet/dockertools/docker.go
+7
-13
No files found.
pkg/kubelet/dockertools/docker.go
View file @
0458d707
...
...
@@ -20,7 +20,6 @@ import (
"fmt"
"math/rand"
"net/http"
"os"
"path"
"strconv"
"strings"
...
...
@@ -283,19 +282,14 @@ func LogSymlink(containerLogsDir, podFullName, containerName, dockerId string) s
return
path
.
Join
(
containerLogsDir
,
fmt
.
Sprintf
(
"%s_%s-%s.%s"
,
podFullName
,
containerName
,
dockerId
,
LogSuffix
))
}
// Get a
docker endpoint, either from the string passed in, or $DOCKER_HOST environment variables
func
getDockerEndpoint
(
dockerEndpoint
string
)
string
{
var
endpoint
string
// Get a
*docker.Client, either using the endpoint passed in, or using
// DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT path per their spec
func
getDockerClient
(
dockerEndpoint
string
)
(
*
docker
.
Client
,
error
)
{
if
len
(
dockerEndpoint
)
>
0
{
endpoint
=
dockerEndpoint
}
else
if
len
(
os
.
Getenv
(
"DOCKER_HOST"
))
>
0
{
endpoint
=
os
.
Getenv
(
"DOCKER_HOST"
)
}
else
{
endpoint
=
"unix:///var/run/docker.sock"
glog
.
Infof
(
"Connecting to docker on %s"
,
dockerEndpoint
)
return
docker
.
NewClient
(
dockerEndpoint
)
}
glog
.
Infof
(
"Connecting to docker on %s"
,
endpoint
)
return
endpoint
return
docker
.
NewClientFromEnv
()
}
func
ConnectToDockerOrDie
(
dockerEndpoint
string
)
DockerInterface
{
...
...
@@ -304,7 +298,7 @@ func ConnectToDockerOrDie(dockerEndpoint string) DockerInterface {
VersionInfo
:
docker
.
Env
{
"ApiVersion=1.18"
},
}
}
client
,
err
:=
docker
.
NewClient
(
getDockerEndpoint
(
dockerEndpoint
)
)
client
,
err
:=
getDockerClient
(
dockerEndpoint
)
if
err
!=
nil
{
glog
.
Fatalf
(
"Couldn't connect to docker: %v"
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment