Skip to content

Instantly share code, notes, and snippets.

@garand
Created February 8, 2017 20:38
Show Gist options
  • Save garand/b83e63b2ea48e17195465a078611296b to your computer and use it in GitHub Desktop.
Save garand/b83e63b2ea48e17195465a078611296b to your computer and use it in GitHub Desktop.
Bash script to open the currently running Docker container that is using port 80
docker-open() {
open http://${(L)$(hostname -s)}.local:`docker inspect --format='{{(index (index .NetworkSettings.Ports "80/tcp") 0).HostPort}}' $(docker-compose ps -q)`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment