Below is my entrypoint.ps1
( PowerShell -script):
Set-Location -Path C:\nginx
& "C:\nginx\Configure-Nginx.ps1"
& "C:\nginx\nginx.exe"
I need to my Configure-Nginx.ps1
and node.exe
were executed on docker run
so I've put an entrypoint to my Dockerfile
:
FROM nginx
# nginx is a custom image that's based on mcr.microsoft.com/windows/servercore:1809-KB5003171
COPY entrypoint.ps1 ./
COPY install/Configure-Nginx.ps1 /nginx/Configure-Nginx.ps1
ENTRYPOINT ["powershell", "entrypoint.ps1"]
However my container begins to restart each minute... Well, I've decided there is a some error in the script then I run this image manually with --entrypoint powershell
and executed my script in the console directly: .\entrypoint.ps1
. The script was frozen (cuz nginx
was launched) and I could connect to my container from web-browser on the host machine... So everything works! Then why doesn't it work if I call my entrypoint from Dockerfile
? What's difference? Maybe someone has met a similar problem...
PS The container is based on mcr.microsoft.com/windows/servercore:1809-KB5003171
with PowerShell v5.1.17763.1852
Firs make sure the script is available under the container root:
COPY entrypoint.ps1 /entrypoint.ps1
Then execute it either by -Command
or -File
:
ENTRYPOINT ["pwsh", "-Command", "/entrypoint.ps1"]
ENTRYPOINT ["pwsh", "-File","/entrypoint.ps1"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.