Skip to content

Commit

Permalink
Merge branch '0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
shynome committed Jun 2, 2021
2 parents 23d180c + a239b53 commit 77e8f2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.2.1

### Fix

- 只要是`bridge`的网路都有可能是容器的`bridge`网络, 这次修改后`docker-compose`创建的容器 IP 也能获取到了
2 changes: 1 addition & 1 deletion cmd/dcip/dcip.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func reportError(err error) {

func main() {
ctx := kong.Parse(&CLI,
kong.Vars{"version": "0.2.0"},
kong.Vars{"version": "0.2.1"},
)
switch ctx.Command() {
case "of <[host|name]>":
Expand Down
2 changes: 1 addition & 1 deletion ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dcip

import "fmt"

var getNetworks = "docker network ls --format='{{.Name}}' | grep -E 'bridge|docker_gwbridge'"
var getNetworks = "docker network ls --filter=driver=bridge --format='{{.Name}}'"
var getAllConatinersIP = fmt.Sprintf("for dn in $(%s);do docker network inspect $dn --format '{{range $k,$c:=.Containers}}{{$k}}/{{.IPv4Address}}{{println}}{{end}}';done", getNetworks)
var getContainerID = "docker ps --latest -q --no-trunc --filter='name=%s'"
var getIPOnly = "awk -F '/' '{print $2}'"
Expand Down

0 comments on commit 77e8f2c

Please sign in to comment.