简体   繁体   中英

Docker service container, error : Service 'w3svc' has been stopped

I'm trying to create multiple containers using "Docker swarm" on Windows Server 2016 my service has been created and replicated but it's not stable it's running with an error.

PS C:\Users\tmman\Desktop\stackdeploy> docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                                           PORTS
xw6kqqu7o4ad        demo_db             replicated          1/1                 microsoft/mssql-server-windows-express:latest
kkrpxwiytax9        demo_web            replicated          1/1                 microsoft/iis:latest                            *:80->80/tcp

PS C:\Users\tmman\Desktop\stackdeploy> docker service ps demo_web demo_db
ID                  NAME                IMAGE                                           NODE                DESIRED STATE       CURRENT STATE            ERROR                              PORTS
1s4ybqny71sd        demo_web.1          microsoft/iis:latest                            DELEI4127           Running             Starting 2 seconds ago
uohf736ux1ne         \_ demo_web.1      microsoft/iis:latest                            DELEI4127           Shutdown            Failed 7 seconds ago     "task: non-zero exit (21479438…"
owpguwtbpdxc         \_ demo_web.1      microsoft/iis:latest                            DELEI4127           Shutdown            Failed 16 seconds ago    "starting container failed: co…"
dg54mihkflbx         \_ demo_web.1      microsoft/iis:latest                            DELEI4127           Shutdown            Failed 25 seconds ago    "task: non-zero exit (21475000…"
7enznbiqjfp5         \_ demo_web.1      microsoft/iis:latest                            DELEI4127           Shutdown            Failed 37 seconds ago    "starting container failed: co…"
o541pdex9s3p        demo_db.1           microsoft/mssql-server-windows-express:latest   DELEI4127           Running             Running 11 minutes ago

PS C:\Users\tmman\Desktop\stackdeploy> docker ps -a
CONTAINER ID        IMAGE                                           COMMAND                   CREATED             STATUS                               PORTS               NAMES
017afe0a6211        microsoft/iis:latest                            "C:\\ServiceMonitor.e…"   18 seconds ago      Up 10 seconds                        80/tcp              demo_web.1.1s4ybqny71sds3i9h47i59g4s
5889ac4ef8d2        microsoft/iis:latest                            "C:\\ServiceMonitor.e…"   27 seconds ago      Exited (2147943855) 19 seconds ago                       demo_web.1.uohf736ux1neaz5u0p1d73jx4
dce80549e789        microsoft/iis:latest                            "C:\\ServiceMonitor.e…"   37 seconds ago      Created                              80/tcp              demo_web.1.owpguwtbpdxc50em7a3rc8m05
92721722311c        microsoft/iis:latest                            "C:\\ServiceMonitor.e…"   48 seconds ago      Exited (2147500037) 38 seconds ago                       demo_web.1.dg54mihkflbxt2j0wd6tv8qlt
166d29256771        microsoft/iis:latest                            "C:\\ServiceMonitor.e…"   11 minutes ago      Created                              80/tcp              demo_web.1.7enznbiqjfp5hdvjbgvnj1q1v
fbc3deb1930e        microsoft/mssql-server-windows-express:latest   "powershell -Command…"    11 minutes ago      Up 11 minutes                                            demo_db.1.o541pdex9s3pmaaty8xzkezpx

Error:
PS C:\Users\tmman\Desktop\stackdeploy> docker service logs demo_web
demo_web.1.1vwqd9xgvfd3@DELEI4127    |
demo_web.1.1vwqd9xgvfd3@DELEI4127    |  Service 'w3svc' has been stopped
demo_web.1.1vwqd9xgvfd3@DELEI4127    |
demo_web.1.8vs509jzpwb9@DELEI4127    |
demo_web.1.8vs509jzpwb9@DELEI4127    |  Service 'w3svc' has been stopped
demo_web.1.8vs509jzpwb9@DELEI4127    |
demo_web.1.8vs509jzpwb9@DELEI4127    | Failed to update IIS configuration
demo_web.1.1vwqd9xgvfd3@DELEI4127    | Failed to update IIS configuration
demo_web.1.z7yhqf1wqqiu@DELEI4127    |
demo_web.1.z7yhqf1wqqiu@DELEI4127    |  Service 'w3svc' has been stopped
demo_web.1.z7yhqf1wqqiu@DELEI4127    |
demo_web.1.pt4du3jr20nj@DELEI4127    |
demo_web.1.pt4du3jr20nj@DELEI4127    |  Service 'w3svc' has been stopped
demo_web.1.pt4du3jr20nj@DELEI4127    |
demo_web.1.z7yhqf1wqqiu@DELEI4127    | Failed to update IIS configuration
demo_web.1.pt4du3jr20nj@DELEI4127    | Failed to update IIS configuration

PS C:\Users\tmman\Desktop\stackdeploy> docker info
Containers: 6
Running: 2
Paused: 0
Stopped: 4
Images: 3
Server Version: 18.09.2
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: active
 NodeID: 1oef3sisa3el3q46tz7aj78eu
 Is Manager: true
 ClusterID: k4l6x9b42bg7bfnf630g3g2h1
 Managers: 1
 Nodes: 1
 Default Address Pool: 10.0.0.0/8
 SubnetSize: 24
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 10.49.2.50
 Manager Addresses:
  10.49.2.50:2377
Default Isolation: process
Kernel Version: 10.0 14393 (14393.2848.amd64fre.rs1_release.190305-1856)
Operating System: Windows Server 2016 Standard Version 1607 (OS Build 14393.2848)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 7.999GiB
Name: DELEI4127
ID: 5BCA:25XO:U3TH:JYXD:BULV:MWXO:UWYF:APIZ:AVCF:R2QO:6KFL:A5SE
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

my Dockerfile :

FROM microsoft/iis:nanoserver

WORKDIR /inetpub/wwwroot

RUN powershell -Command `

Add-WindowsFeature Web-Server; 
Invoke-WebRequest -UseBasicParsing -Uri "https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.6/ServiceMonitor.exe" -OutFile "C:\ServiceMonitor.exe"

EXPOSE 80

ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]

COPY index.html /index.html 

my YML.file:

version: "3"

services:

db:
    image: microsoft/mssql-server-windows-express
    networks: 
       - cpxnet

    deploy:

    environment:
       - SA_PASSWORD=Abcd1234
       - ACCEPT_EULA=Y

web:
    image: microsoft/iis:latest

    networks: 
       - cpxnet


    deploy:
        resources:
            limits:

                memory: 50M 
    ports:
     -  "80:80"

    depends_on:
        - db


networks: 
    cpxnet:

I got some solutions from this website: https://github.com/Microsoft/aspnet-docker/issues/64 but didn't help with my error

Thank you in advance for your help!! Note!!!: i'm a beginner

I faced similar issue n had almost similar dockerfile.
To troubleshoot I changed the entrypoint to continuous ping to local host. So that I could login to container n check the issue with w3svc.

I found strange multiple events in event viewer (need to view in powershell) that w3svc is started successfully. There were no stop event. But I concluded that something wrong with my service.

I further checked n found that app pool is in "OnDemand" state instead of "always running". I set the apppool property to always running in my dockerfile. Post that switched entrypoint to original value "service monitor.exe w3svc" n it made my container stable. Note - I m not using default iis image where service monitor already set as entrypoint.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM