Search code examples
dockerdocker-swarm

Docker swarm node failing 'non-zero exit'


I'm working through a getting started example, but I'm having problems when attempting to deploy an image to a swarm. Specifically, all nodes end up failing with the following error message:

"task: non-zero exit (2147516553)"

The image works when loaded in a single container - but won't run in a swarm.

dockerfile:

FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .

ENTRYPOINT ["dotnet", "dotNetCore.dll"]

docker-compose.yml:

version: "3"
services:
  web:
    image: [repo]/get-started
    deploy:
      replicas: 5
      resources:
        limits:
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "8080:5000"
    networks:
      - webnet
networks:
  webnet:

It looks like all the nodes start properly (get to a running state). But then fail with the error message.


Solution

  • Memory limit of 50Mb is definitely too low for your service