I am using WindowsServerCore 2019 and I want to set ip address for my container and start my application. For this purpose I use powershell script:
$ip_address = "10.10.10.15"
$subnet_mask = "255.255.255.0"
$gateway = "10.10.10.1"
netsh interface ip set address name="Ethernet" static $ip_address $subnet_mask $gateway
Start-Process "C:\prog\main.exe" -wait
After script ran in terminal I can use command ipconfig, and my ip address has been changed, but my app has been started and after some seconds container stopped. Why did this happen ?
My docker compose:
version: '3'
services:
ana:
build: ./sa
command: powershell.exe -ExecutionPolicy Bypass -File ./work/script_static_ip.ps1