Skip to content

Commit

Permalink
Explicitly inspect network ingress
Browse files Browse the repository at this point in the history
"docker inspect ingress" relies on "ingress" being a network name and not used as container name ...
`docker run --name ingress hello-world ; docker inspect ingress` will happily return the inspect-json of the recently run container, instead of the network.
I suspect the same will be true for a service or stack named `ingress`.
  • Loading branch information
gumbo2k authored and struanb committed Apr 26, 2022
1 parent f761a8d commit 747e53d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docker-ingress-routing-daemon
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

VERSION=4.1.0
VERSION=4.1.1

# Ingress Routing Daemon v4.1.0
# Ingress Routing Daemon v4.1.1
# Copyright © 2020-2021 Struan Bartlett
# ----------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -44,7 +44,7 @@ quit() {

detect_ingress() {
read INGRESS_SUBNET INGRESS_DEFAULT_GATEWAY \
< <(docker inspect ingress --format '{{(index .IPAM.Config 0).Subnet}} {{index (split (index .Containers "ingress-sbox").IPv4Address "/") 0}}' 2>/dev/null)
< <(docker network inspect ingress --format '{{(index .IPAM.Config 0).Subnet}} {{index (split (index .Containers "ingress-sbox").IPv4Address "/") 0}}' 2>/dev/null)

[ -n "$INGRESS_SUBNET" ] && [ -n "$INGRESS_DEFAULT_GATEWAY" ] && nsenter --net=/var/run/docker/netns/ingress_sbox iptables -L >/dev/null && return 0

Expand Down

0 comments on commit 747e53d

Please sign in to comment.