Browse Source

Update README.md

Include helper function.
Werner Beroux 9 years ago
parent
commit
2f140fae43
1 changed files with 13 additions and 1 deletions
  1. 13 1
      README.md

+ 13 - 1
README.md

@@ -35,7 +35,7 @@ Supposing you've an Apache or Nginx Docker container named `web_service_containe
 
     $ docker run --rm -it --link web_service_container wernight/ngrok ngrok http web_service_container:80
 
-## Full example
+### Full example
 
  1. We'll set up a simple example HTTP server in a docker container named `www`:
 
@@ -57,6 +57,18 @@ Supposing you've an Apache or Nginx Docker container named `web_service_containe
 
         $ xdg-open http://$(docker port www_ngrok 4040)
 
+### Helper
+
+For common cases you may want to create an alias in your `~/.profile` (or `~/.bashrc`, `~/.zshrc`, or equivalent):
+
+    function docker-ngrok() {
+      docker run --rm -it --link "$1":http wernight/ngrok ngrok http http:80
+    }
+    # For ZSH with Oh-My-Zsh! and 'docker' plugin enabled, you can also enable auto-completion:
+    #compdef __docker_containers docker-ngrok
+
+Then to the simple example just do `docker-ngrok web_service_container`.
+
 
 ## Feedbacks