Code Monkey home page Code Monkey logo

Comments (7)

StefanScherer avatar StefanScherer commented on June 6, 2024

Not only the space is wrong, there should be only one IP address.
Well, I normally run this in VMware environment, not in VirtualBox, so I don't have much experience how two boxes could work in parallel.

from windows-docker-machine.

jantimon avatar jantimon commented on June 6, 2024

I am not sure if it will work at all for two instances because of the ports.
The main problem however is that docker breaks and it is really hard to find out why.

Do you have any idea how we might fix that spacing issues to prevent docker from breaking?

from windows-docker-machine.

StefanScherer avatar StefanScherer commented on June 6, 2024

Maybe after line 17 we have to get rid of everything after the space. Donβ€˜t know why there are sometimes two IP addresses.

from windows-docker-machine.

jantimon avatar jantimon commented on June 6, 2024

Another solution would be to throw an error if two IP addresses are present.

But I would probably prefer to get rid of the space.

from windows-docker-machine.

StefanScherer avatar StefanScherer commented on June 6, 2024

I found a similar issue/pr #56 where we also couldn't find the reason.

But maybe it makes sense to filter out all IP addresses beginning with 169.254 πŸ€”

 ($_.IPAddress).StartsWith("169.254.")

and put it into the filterscript somehow.

from windows-docker-machine.

jantimon avatar jantimon commented on June 6, 2024

I like the idea πŸ‘

this is the full `Get-NetIPAddress` output I receive (click to expand)
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : poB:DDC:noD>?o<D>opoDl<p=/;@55;@55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 
    2019-box: IPv6Address              : fe80::90de:45e2:4efe:b2f3%16
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 64
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv6
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : Ethernet 2
    2019-box: InterfaceIndex           : 16
    2019-box: IPAddress                : fe80::90de:45e2:4efe:b2f3%16
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Link
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 16
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : poB:DD>m<pDm<:pD@<BpDCo;@/;<55;<55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 
    2019-box: IPv6Address              : fe80::4c2f:c20f:628f:9e16%12
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 64
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv6
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : vEthernet (nat)
    2019-box: InterfaceIndex           : 12
    2019-box: IPAddress                : fe80::4c2f:c20f:628f:9e16%12
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Link
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 12
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : poB:DD?m@@DBCk=Dl?>@DBo>;/=55=55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 
    2019-box: IPv6Address              : fe80::5c66:89a3:b546:8e41%3
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 64
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv6
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : Ethernet
    2019-box: InterfaceIndex           : 3
    2019-box: IPAddress                : fe80::5c66:89a3:b546:8e41%3
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Link
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 3
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : DD;55;55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 
    2019-box: IPv6Address              : ::1
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 128
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv6
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : Loopback Pseudo-Interface 1
    2019-box: InterfaceIndex           : 1
    2019-box: IPAddress                : ::1
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : WellKnown
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 1
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : ;C<8;@B8CC8C:55;@55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 192.168.99.90
    2019-box: IPv6Address              : 
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 24
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv4
    2019-box: AddressState             : Duplicate
    2019-box: InterfaceAlias           : Ethernet 2
    2019-box: InterfaceIndex           : 16
    2019-box: IPAddress                : 192.168.99.90
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : Manual
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Manual
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 16
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : ;@C8<?>8;AB8<>=55;@55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 169.254.178.243
    2019-box: IPv6Address              : 
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 16
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv4
    2019-box: AddressState             : Tentative
    2019-box: InterfaceAlias           : Ethernet 2
    2019-box: InterfaceIndex           : 16
    2019-box: IPAddress                : 169.254.178.243
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Link
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 16
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : ;C<8;@B8;@:8;55;<55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 192.168.160.1
    2019-box: IPv6Address              : 
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 20
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv4
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : vEthernet (nat)
    2019-box: InterfaceIndex           : 12
    2019-box: IPAddress                : 192.168.160.1
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : Manual
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Manual
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 12
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : ;:8:8<8;?55=55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 10.0.2.15
    2019-box: IPv6Address              : 
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 24
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv4
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : Ethernet
    2019-box: InterfaceIndex           : 3
    2019-box: IPAddress                : 10.0.2.15
    2019-box: PreferredLifetime        : 23:59:32
    2019-box: PrefixOrigin             : Dhcp
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : Dhcp
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 23:59:32
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 3
    2019-box: Caption                  : 
    2019-box: Description              : 
    2019-box: ElementName              : 
    2019-box: InstanceID               : 
    2019-box: CommunicationStatus      : 
    2019-box: DetailedStatus           : 
    2019-box: HealthState              : 
    2019-box: InstallDate              : 
    2019-box: Name                     : ;<A8:8:8;55;55;55;
    2019-box: OperatingStatus          : 
    2019-box: OperationalStatus        : 
    2019-box: PrimaryStatus            : 
    2019-box: Status                   : 
    2019-box: StatusDescriptions       : 
    2019-box: AvailableRequestedStates : 
    2019-box: EnabledDefault           : 2
    2019-box: EnabledState             : 
    2019-box: OtherEnabledState        : 
    2019-box: RequestedState           : 12
    2019-box: TimeOfLastStateChange    : 
    2019-box: TransitioningToState     : 12
    2019-box: CreationClassName        : 
    2019-box: SystemCreationClassName  : 
    2019-box: SystemName               : 
    2019-box: NameFormat               : 
    2019-box: OtherTypeDescription     : 
    2019-box: ProtocolIFType           : 4096
    2019-box: ProtocolType             : 
    2019-box: Address                  : 
    2019-box: AddressOrigin            : 0
    2019-box: AddressType              : 
    2019-box: IPv4Address              : 127.0.0.1
    2019-box: IPv6Address              : 
    2019-box: IPVersionSupport         : 
    2019-box: PrefixLength             : 8
    2019-box: SubnetMask               : 
    2019-box: AddressFamily            : IPv4
    2019-box: AddressState             : Preferred
    2019-box: InterfaceAlias           : Loopback Pseudo-Interface 1
    2019-box: InterfaceIndex           : 1
    2019-box: IPAddress                : 127.0.0.1
    2019-box: PreferredLifetime        : 10675199.02:48:05.4775807
    2019-box: PrefixOrigin             : WellKnown
    2019-box: SkipAsSource             : False
    2019-box: Store                    : ActiveStore
    2019-box: SuffixOrigin             : WellKnown
    2019-box: Type                     : Unicast
    2019-box: ValidLifetime            : 10675199.02:48:05.4775807
    2019-box: PSComputerName           : 
    2019-box: ifIndex                  : 1

I am not that familiar with powershell but I guess we would need the following statement:

$machineIp=(Get-NetIPAddress -AddressFamily IPv4 `
    | Where-Object -FilterScript { `
      ( ! ($_.InterfaceAlias).StartsWith("vEthernet (") ) `
      -And $_.IPAddress -Ne "127.0.0.1" `
      -And $_.IPAddress -Ne "10.0.2.15" `
      -And !($_.IPAddress).StartsWith("169.254.") `
    }).IPAddress

I'll give it a try

from windows-docker-machine.

StefanScherer avatar StefanScherer commented on June 6, 2024

Fixed with #69

from windows-docker-machine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.