vmware / powerclicore

PowerCLI Core Dockerfile
Apache License 2.0
97 stars 48 forks source link

docker run --detach not working #35

Open dR3b opened 6 years ago

dR3b commented 6 years ago

If I try to start "docker" with "--detach", no output is created:

xxx@xxx ~/tmp/docker % ll
-rw-r--r-- 1 xxx xxx 380 25. Apr 14:47 getvm.ps1
xxx@xxx ~/tmp/docker % docker run --rm -it --detach --entrypoint="/bin/pwsh" \
  -v ~/tmp/docker:/data vmware/powerclicore /data/getvm.ps1
a37dd79c8c846f39737b710d5c53920dcd0c5a073f15b3648ec7c940478cb1cf   
xxx@xxx ~/tmp/docker % docker ps -a -q
a37dd79c8c84
xxx@xxx ~/tmp/docker % docker ps -a -q
xxx@xxx ~/tmp/docker % ll
-rw-r--r-- 1 xxx xxx 380 25. Apr 14:47 getvm.ps1
-rw-r--r-- 1 root root 3 25. Apr 14:49 getvm.txt

Without "--detach" everything works as expected:

-rw-r--r-- 1 xxx xxx  380 25. Apr 14:47 getvm.ps1
-rw-r--r-- 1 root root 3537 25. Apr 15:01 getvm.txt

getvm.ps1:

$VI_SERVER = "xxx"
$VI_USERNAME = "xxx"
$VI_PASSWORD = "xxx"

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
Connect-VIServer -Server $VI_SERVER -User $VI_USERNAME -password $VI_PASSWORD | Out-Null
Out-File -FilePath /data/getvm.txt -InputObject $(Get-VM) -Force
Disconnect-VIServer * -Confirm:$false | Out-Null

sysinfo:

Server Version: 18.04.0-ce
Kernel Version: 4.16.3-1-ARCH
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 31.31GiB
jakerobinson commented 6 years ago

@dR3b Can you test if the behavior is the same with the Ubuntu16.04 version of the container?

docker pull vmware/powerclicore:ubuntu16.04
dR3b commented 6 years ago

Good idea but this doesn't work either. I have the same behavior.

dR3b commented 6 years ago

Please tell me if I'm right and if this is how it should work.

tenthirtyam commented 2 weeks ago

@atanasa - recommended for closure based on age of the issue and 0 reactions.

Ryan Johnson Distinguished Engineer, VMware by Broadcom

dR3b commented 2 weeks ago

.... and 0 reactions from?

tenthirtyam commented 2 weeks ago

It's very common practice to upvote an issue by adding a 👍 reaction to the original issue initial description to signify that others have/are experienced the issue (or support an enhancement) which helps maintainers and prioritize.

tenthirtyam commented 2 weeks ago

Either way, try adding a delay with a Start-Sleep at the end of your PowerShell script to give it time to finish writing the file before the container stops. Worth a test.