Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
9565fa64
Unverified
Commit
9565fa64
authored
Sep 05, 2024
by
Daniel Hiltgen
Committed by
GitHub
Sep 05, 2024
Browse files
Revert "Detect running in a container (#6495)" (#6662)
This reverts commit
a60d9b89
.
parent
67190976
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
23 deletions
+1
-23
server/images.go
server/images.go
+1
-23
No files found.
server/images.go
View file @
9565fa64
package
server
package
server
import
(
import
(
"bufio"
"bytes"
"bytes"
"cmp"
"cmp"
"context"
"context"
...
@@ -18,12 +17,10 @@ import (
...
@@ -18,12 +17,10 @@ import (
"net/url"
"net/url"
"os"
"os"
"path/filepath"
"path/filepath"
"regexp"
"runtime"
"runtime"
"slices"
"slices"
"strconv"
"strconv"
"strings"
"strings"
"sync"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/auth"
"github.com/ollama/ollama/auth"
...
@@ -1090,7 +1087,7 @@ func makeRequest(ctx context.Context, method string, requestURL *url.URL, header
...
@@ -1090,7 +1087,7 @@ func makeRequest(ctx context.Context, method string, requestURL *url.URL, header
}
}
}
}
req
.
Header
.
Set
(
"User-Agent"
,
fmt
.
Sprintf
(
"ollama/%s (%s %s) Go/%s
%s
"
,
version
.
Version
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
()
,
deployment
()
))
req
.
Header
.
Set
(
"User-Agent"
,
fmt
.
Sprintf
(
"ollama/%s (%s %s) Go/%s"
,
version
.
Version
,
runtime
.
GOARCH
,
runtime
.
GOOS
,
runtime
.
Version
()))
if
s
:=
req
.
Header
.
Get
(
"Content-Length"
);
s
!=
""
{
if
s
:=
req
.
Header
.
Get
(
"Content-Length"
);
s
!=
""
{
contentLength
,
err
:=
strconv
.
ParseInt
(
s
,
10
,
64
)
contentLength
,
err
:=
strconv
.
ParseInt
(
s
,
10
,
64
)
...
@@ -1165,22 +1162,3 @@ func verifyBlob(digest string) error {
...
@@ -1165,22 +1162,3 @@ func verifyBlob(digest string) error {
return
nil
return
nil
}
}
var
deployment
=
sync
.
OnceValue
(
func
()
string
{
if
runtime
.
GOOS
==
"linux"
{
file
,
err
:=
os
.
Open
(
"/proc/1/cgroup"
)
if
err
!=
nil
{
return
""
}
defer
file
.
Close
()
anchorPoint
:=
regexp
.
MustCompile
(
"0::/.*/"
)
scanner
:=
bufio
.
NewScanner
(
file
)
for
scanner
.
Scan
()
{
line
:=
scanner
.
Text
()
if
anchorPoint
.
MatchString
(
line
)
{
return
" container"
}
}
}
return
""
})
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