| 1 |
# syntax = docker/dockerfile:1.2.1 |
| 2 |
FROM python:3.12-windowsservercore-ltsc2022 |
| 3 |
SHELL ["powershell"] |
| 4 |
|
| 5 |
|
| 6 |
RUN Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'; \ |
| 7 |
Write-Host 'Install OpenSSH Server...'; \ |
| 8 |
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0; \ |
| 9 |
Write-Host 'Initializing OpenSSH Server...'; \ |
| 10 |
Start-Service sshd; \ |
| 11 |
Stop-Service sshd |
| 12 |
|
| 13 |
# This is apparently the only way to keep the sshd service running. |
| 14 |
# Running sshd in the foreground in the context of a user (as it is done for linux), doesn't work under Windows. |
| 15 |
# Even if it is started as admin user, errors occur during logon (lack of some system rights) |
| 16 |
CMD powershell -NoExit -Command "Start-Service sshd" |