i have docker-compose that run script for changing IP and run .exe programm in servercore on docker container. But i dont see result of this exe . (ip changes).
Also i`m tryign to run the exe in cmd inside of container, in this case everything is working.
Docker-compose.yml
version: '3'
services:
ana:
build: ./sa
command: powershell.exe -ExecutionPolicy Bypass -File ./work/script_static_ip.ps1
Dockerfile:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
COPY ./prog ./prog/
COPY ./script_static_ip.ps1 ./prog/
script .ps1:
$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
I confess I'm not an expert in Docker Compose, but let's check a few things. To clarify: Are you saying if you manually run the script inside the container it works, but you wanted it to run at startup time and that is not working? What does the dockerfile of your image looks like?