The issue is that you can't reference the changed value in the same task.
I created a new Powershell task and just called Write-Host "env:IP environment variable set to ($env:IP)" which output the IP address correctly.
According to your screen dump you have your port 80 mapped to the Traefik container
58cd5b59579c traefik:v2.2 "/entrypoint.sh --lo…" 16 minutes ago Up 15 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp frappe_docker_traefik_1
The listen address of this mapping is 0.0.0.0 on both port 80 HTTP, and 443 ...