netbird
netbird copied to clipboard
Info Docker Version
It's strange not having the CLI installed for the netbirdio/netbird:latest Docker image
I also wanted to know how I can Dockerize my app using the netbirdio/netbird:latest Docker image. For example I would like to install InfluxDB or Mysql in the netbirdio/netbird:latest image
Thanks in advance
Hello @corasaniti the binary is part of the docker image, but is not in the path. Since we are using alpine now we will update it so it will be in the path. You can see the current Dockerfile here: https://github.com/netbirdio/netbird/blob/main/client/Dockerfile
As for the second question, you have a couple of options: one is to build the image, copy the binary, and then run netbird in the background, and the other is to use netbird as a side-car container. Below, you will find an example for both:
Build new Nginx image with NetBird Dockerfile
# NetBird build image
FROM netbirdio/netbird:latest as netbird-build
FROM nginx:alpine
# Copy NetBird binary
COPY --from=netbird-build /go/bin/netbird /bin/netbird
# Copy modified entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT /entrypoint.sh
entrypoint.sh
#!/bin/sh
echo "Starting netbird"
/bin/netbird up &
echo "running regular entrypoint script"
/regular_entrypoint.sh
Run NetBird as sidecar container
version: '3.8'
services:
nginx:
image: nginx:alpine
volumes:
- ./content:/usr/share/nginx/html:ro
ports:
- 80:80 # needed for access without netbird
netbird:
image: netbirdio/netbird:latest
volumes:
- ./client:/etc/netbird
cap_add:
- NET_ADMIN
- SYS_ADMIN
- SYS_RESOURCE
environment:
NB_SETUP_KEY: SETUP_KEY
NB_HOSTNAME: <hostname>
# link NetBird network to Nginx
network_mode: "service:nginx"
Hi, Is this a video bounty?
@neo773 no, that's some bug from Algora.
no, we don't have a bounty for this issue. I've contacted Algora to check this.
@mlsmaycon thanks for providing this example as a sidecar example, it worked great for me.
I looked around the documentation for something like this and didn't find anything, it might be useful to add to the official docs?
hello @adasauce , yes it would be great! If you want to contribute, you can open a pull request in our docs: https://github.com/netbirdio/docs
Hi @mlsmaycon!
Thanks for the side-car container example provided at https://github.com/netbirdio/netbird/issues/1621#issuecomment-1963580878, it works great!
Anyway, I have a few questions about the Docker client implementation (by the way, I'm using your cloud service, not a self-hosted installation):
- Why does the
/go/bin/netbird status
command report nothing? Here you have what the output looks like:
Error: failed to connect to daemon error: context deadline exceeded
If the daemon is not running please run:
- Why can't I ping my netbird devices by their hostnames? From my computer I can ping them with no problem, but from the Docker container is always says:
ping: bad address '<hostname>'
Many thanks again for your work!