summaryrefslogtreecommitdiff
path: root/pkg/api/server
diff options
context:
space:
mode:
authorzhangguanzhang <guanzhangzhang@gmail.com>2020-06-12 19:54:10 +0800
committerGitHub <noreply@github.com>2020-06-12 19:54:10 +0800
commit64eae15aa7905dd49f4a348f6b4765dfb4d9dd91 (patch)
tree2914c20a2e0e15383da50334cad89b9b85b209a1 /pkg/api/server
parent3218736cff4b718b8fe855759687cb66f19d6e1e (diff)
parent8aa5cf3d45998bc92eaafd67ab2a59e3722bade4 (diff)
downloadpodman-64eae15aa7905dd49f4a348f6b4765dfb4d9dd91.tar.gz
podman-64eae15aa7905dd49f4a348f6b4765dfb4d9dd91.tar.bz2
podman-64eae15aa7905dd49f4a348f6b4765dfb4d9dd91.zip
Merge pull request #1 from containers/master
# sync
Diffstat (limited to 'pkg/api/server')
-rw-r--r--pkg/api/server/docs.go25
-rw-r--r--pkg/api/server/handler_api.go6
-rw-r--r--pkg/api/server/server.go2
3 files changed, 29 insertions, 4 deletions
diff --git a/pkg/api/server/docs.go b/pkg/api/server/docs.go
index c989c7927..124c16092 100644
--- a/pkg/api/server/docs.go
+++ b/pkg/api/server/docs.go
@@ -4,6 +4,31 @@
// only as experimental as this point. The endpoints, parameters, inputs, and
// return values can all change.
//
+// To start the service and keep it running for 5,000 seconds (-t 0 runs forever):
+//
+// podman system service -t 5000 &
+//
+// You can then use cURL on the socket using requests documented below.
+//
+// NOTE: if you install the package podman-docker, it will create a symbolic
+// link for /var/run/docker.sock to /run/podman/podman.sock
+//
+// See podman-service(1) for more information.
+//
+// Quick Examples:
+//
+// 'podman info'
+//
+// curl --unix-socket /run/podman/podman.sock http://d/v1.0.0/libpod/info
+//
+// 'podman pull quay.io/containers/podman'
+//
+// curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v1.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'
+//
+// 'podman list images'
+//
+// curl --unix-socket /run/podman/podman.sock -v 'http://d/v1.0.0/libpod/images/json' | jq
+//
// Terms Of Service:
//
// Schemes: http, https
diff --git a/pkg/api/server/handler_api.go b/pkg/api/server/handler_api.go
index 7a7db12f3..dbdb7f17b 100644
--- a/pkg/api/server/handler_api.go
+++ b/pkg/api/server/handler_api.go
@@ -34,9 +34,9 @@ func (s *APIServer) APIHandler(h http.HandlerFunc) http.HandlerFunc {
}
// TODO: Use r.ConnContext when ported to go 1.13
- c := context.WithValue(r.Context(), "decoder", s.Decoder)
- c = context.WithValue(c, "runtime", s.Runtime)
- c = context.WithValue(c, "shutdownFunc", s.Shutdown)
+ c := context.WithValue(r.Context(), "decoder", s.Decoder) //nolint
+ c = context.WithValue(c, "runtime", s.Runtime) //nolint
+ c = context.WithValue(c, "shutdownFunc", s.Shutdown) //nolint
r = r.WithContext(c)
h(w, r)
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go
index 499a4c58a..bd6a99b96 100644
--- a/pkg/api/server/server.go
+++ b/pkg/api/server/server.go
@@ -257,7 +257,7 @@ func (t *IdleTracker) ConnState(conn net.Conn, state http.ConnState) {
if oldActive == 0 {
t.timer.Stop()
}
- t.total += 1
+ t.total++
case http.StateIdle, http.StateClosed:
delete(t.active, conn)
// Restart the timer if we've become idle