microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.03k stars 399 forks source link

Docker container exits with Segmentation fault when trying to run a SF linux container application in Windows #925

Open priyankajayaswal1 opened 4 years ago

priyankajayaswal1 commented 4 years ago

Background

I am trying to host a linux SF cluster in a windows machine. I am using docker for the same and have referred the three articles stated below for reference.

Question: Am I doing something wrong or that's the expected behavior?

Steps to reproduce:

docker pull droiddocker1/working:1.0.2
docker run --rm -it -v //var/run/docker.sock:/var/run/docker.sock  -p 19000:19000/tcp -p 19083:19080/tcp  droiddocker1/working:1.0.2
cd /home
chown yeoman yeoman/
cd yeoman
su yeoman
sfctl cluster select --endpoint http://localhost:19082/
yo azuresfcontainer
# add in image -> droiddocker1/sf-test-python-app
# run install.sh file inside your app folder

Then once I install the container application, it shows up on the dashboard. After sometime the container exists and the logs show it as.

Segmentation fault      ./FabricHost -c -skipfabricsetup

image

Notes:

  1. I have created a docker image based on mcr.microsoft.com/service-fabric/onebox:latest with the following instructions in Dockerfile. This build is same as one I have above droiddocker1/working:1.0.2
    
    FROM mcr.microsoft.com/service-fabric/onebox:latest
    WORKDIR /home/ClusterDeployer
    RUN ./setup.sh
    #Generate the local

RUN curl -s https://raw.githubusercontent.com/Azure/service-fabric-scripts-and-templates/master/scripts/SetupServiceFabric/SetupServiceFabric.sh | bash RUN curl -sL https://deb.nodesource.com/setup_10.x | bash

RUN apt-get update RUN apt-get install docker.io nodejs sudo --fix-missing -y RUN npm install -g yo RUN npm install -g generator-azuresfcontainer # for Service Fabric container application RUN npm install -g generator-azuresfguest # for Service Fabric guest executable application

yoman specific stuff

RUN echo -n "Node: " && node -v && echo -n "npm: " && npm -v RUN echo "Yeoman Doctor will warn about our npm version being outdated. It is expected and OK."

Add a yeoman user because Yeoman freaks out and runs setuid(501).

This was because less technical people would run Yeoman as root and cause problems.

Setting uid to 501 here since it's already a random number being thrown around.

@see https://github.com/yeoman/yeoman.github.io/issues/282

@see https://github.com/cthulhu666/docker-yeoman/blob/master/Dockerfile

RUN adduser --disabled-password --gecos "" yeoman && \ echo "yeoman ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

EXPOSE 19080 19000 80 443 8080 4000 4001 4002 4003

Start SSH before running the cluster

CMD /etc/init.d/ssh start && ./run.sh


2. The docker image used to create container application **droiddocker1/sf-test-python-app** is same as the one referred in [link](service-fabric-get-started-containers-linux#define-the-docker-container)

References:

1. [/service-fabric-get-started-linux](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-linux)
2. [service-fabric-local-linux-cluster-windows]( https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-local-linux-cluster-windows)
3. [service-fabric-get-started-containers-linux#define-the-docker-container](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-containers-linux#define-the-docker-container)
jwyglendowski-precisionlender commented 4 years ago

I am experiencing the same issue too. Running on win10 box with docker 2.3.0.3(45519). I have tried many different applications event using the voting tutorial with

`Connect-ServiceFabricCluster localhost:19000 #-Verbose

New-ServiceFabricComposeDeployment -DeploymentName voting -Compose docker-compose.yml`

The same thing it registers the application fine, regardless of method used to deploy, when the instance starts up it's inbuild then eventual crashes the container.

with the ./ClusterDeployer.sh: line 210: 234 Segmentation fault ./FabricHost -c -skipfabricsetup

It seems like it's having issue getting to docker hub though I can't be 100% sure. I usually run this in windows where I normally can find logging but in this case I have not found anything.

jwyglendowski-precisionlender commented 4 years ago

@peterpogorski Is this repo still being maintained? Doesn't seem like anyone is responding to these questions. Just trying to get figure out my options. Thanks.

anantshankar17 commented 4 years ago

Hey @tugup the error here is "Container deployment is not supported". Which hosting setting do we need here ? It seems they are running linux clusters on windows machine, and trying to run docker containers on it. Is this even supported ?

gkhanna79 commented 4 years ago

@priyankajayaswal1 Just to confirm what you are trying to do:

1) Create a SF Linux cluster, which is implemented as a Linux container, and executed using Docker on Windows. 2) Attempt to deploy an application to such a cluster that itself is a container-based application. I am interpreting this from the following statement in the DockerFile you shared above:

RUN apt-get install docker.io nodejs sudo --fix-missing -y

Is this correct?

jwyglendowski-precisionlender commented 4 years ago

@gkhanna79 I don't know if it helps but what you described is exactly what I am doing and I am seeing the same issue as @priyankajayaswal1. Following the directions I am able to setup a cluster without issue. While attempting to deploy any of the samples regardless of method used to deploy the application meaning either docker compose or just using plain old Powershell it throws a segmentation fault. I even tried turning on DNS on the cluster which isn't the default setup which didn't have any effect.

jwyglendowski-precisionlender commented 4 years ago

@gkhanna79 Any further research being done on this or you awaiting response for @priyankajayaswal1? Thanks.

maburlik commented 4 years ago

@gkhanna79 may be able to confirm but afaik deploying container-based services when SF is running within a container is not supported. For this dev scenario you would need to set up the SF runtime on a machine that is able to run containers. SF in the container is isolated from its hosting environment and therefore does not have privileges to host containers at the same level.

I agree the segmentation fault is not the best form of alerting and an explicit error here would be preferable.