-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart.ps1
More file actions
18 lines (14 loc) · 808 Bytes
/
start.ps1
File metadata and controls
18 lines (14 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Get the private IP address excluding the loopback interface
$privateIp = (Get-NetIPAddress | Where-Object { $_.AddressFamily -eq 'IPv4' -and $_.IPAddress -ne '127.0.0.1' }).IPAddress
# Check if a private IP was found
if ($privateIp -eq $null) {
Write-Host "Private IP not found!"
exit 1
}
# Print the private IP (you can export it or use it in your docker-compose command)
Write-Host "Private IP: $privateIp"
# Run docker-compose with the private IP (you can set an environment variable or use it directly)
# Set environment variable (optional)
[System.Environment]::SetEnvironmentVariable("PRIVATE_IP", $privateIp, [System.EnvironmentVariableTarget]::User)
# You can now use this private IP in your docker-compose.yml file, e.g., by referencing the environment variable
# docker-compose up -d