Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperswarm on Docker container Segmentation fault #172

Open
sce9sc opened this issue Mar 22, 2024 · 2 comments
Open

hyperswarm on Docker container Segmentation fault #172

sce9sc opened this issue Mar 22, 2024 · 2 comments

Comments

@sce9sc
Copy link

sce9sc commented Mar 22, 2024

I am not sure If hyperswarm should work on docker but when I run it in a container I got Segmentation fault just before the connection is established.

const Hyperswarm = require('hyperswarm')

const main = async ()=>{

    const topic = Buffer.alloc(32).fill('mytestopic') 
    const hyper = new Hyperswarm()
    hyper.on('connection', ()=>{console.log('connected')})
    const discovery = hyper.join(topic, { server: false, client: true })
    await discovery.flushed() // Waits for the topic to be fully announced on the DHT
}

main()

Dockerfile

FROM node:20-alpine

RUN mkdir -p /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
#USER node
RUN npm set strict-ssl false
RUN npm install
COPY . .
EXPOSE 49737/udp
CMD ["node", "main.js"]

@sce9sc
Copy link
Author

sce9sc commented Mar 22, 2024

Using @hyperswarm/doctor has the same effect

@sce9sc
Copy link
Author

sce9sc commented Mar 22, 2024

I found the problem . For some reason node:20-alpine image does not work . It might be that all alpine image are not working but I am not sure . I checked it with node:21-alpine and had the same issue

I used
FROM node:lts-bookworm-slim

and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant