Skip to content

Instantly share code, notes, and snippets.

@guillaumerose
Created August 4, 2017 14:19
Show Gist options
  • Save guillaumerose/a65bfa6d676b687d5030bd602ec89d3c to your computer and use it in GitHub Desktop.
Save guillaumerose/a65bfa6d676b687d5030bd602ec89d3c to your computer and use it in GitHub Desktop.
Convert docker.sock to a http server on 2375
package main
import (
"net/http"
"github.com/docker/engine-api-proxy/proxy"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
passThrough, err := proxy.NewDefaultHandler("unix:///var/run/docker.sock", nil)
if err != nil {
panic(err)
}
router.Handle("/{any:.*}", passThrough)
http.ListenAndServe(":2375", router)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment