Created
August 4, 2017 14:19
-
-
Save guillaumerose/a65bfa6d676b687d5030bd602ec89d3c to your computer and use it in GitHub Desktop.
Convert docker.sock to a http server on 2375
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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