Issue with running a safe ipv4 root node inside a podman container: Failed to bind UDP socket

A root node I cannot even start when I set the public address.

$ podman logs test_rootnode-ipv4
Starting logging to stdout
   0: Cannot start node (log path: unknown). If this is the first node on the network pass the local address to be used using --first

   1: Routing error:: Cannot connect to the endpoint: Failed to bind UDP socket
   2: Cannot connect to the endpoint: Failed to bind UDP socket
   3: Failed to bind UDP socket
Address not available (os error 99)


Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.


$ podman ps -a
CONTAINER ID  IMAGE                                COMMAND     CREATED        STATUS                             PORTS                                                             NAMES
776d9477fd0e  localhost/rootnode-ipv4_test:latest              7 minutes ago  Exited (1) Less than a second ago>12000/tcp,>12000/udp  test_rootnode-ipv4


# Build SafeNetwork docker container
LABEL version="1.1"
LABEL maintainer="Folât Pjêrsômêj"
LABEL release-date="2021-11-18"

# Update and install dependencies
RUN apk update && apk add \
  bash \
  curl \

RUN addgroup -g 1000 admin
RUN adduser -s /bin/bash --ingroup admin --uid 1000 --disabled-password admin
USER admin
WORKDIR /home/admin

# Install latest safe network version.
RUN curl -s -o /tmp/
RUN bash /tmp/

# Set ENV PATH (after build will be used to find the safe node command)
ENV PATH=$PATH:/home/admin/.safe:/home/admin/.safe/node

# Default env values

# Expose PORT of the node

# Assign volume
VOLUME /home/admin/.safe/cli

# Launch safe root node
ENTRYPOINT sn_node -vv --idle-timeout-msec 5500 --keep-alive-interval-msec 4000 --skip-igd --local-addr $ROOTNODE_IP:$ROOTNODE_PORT --public-addr $ROOTNODE_IP:$ROOTNODE_PORT --first

Your error is in the last line of your Dockerfile:

The literal command executed will be --public-addr $ROOTNODE_IP:$ROOTNODE_PORT, where these variables are not interpolated. See this SO answer for an alternative. (There are a handful of instructions that do work with variables, like EXPOSE you are using, see Dockerfile reference | Docker Documentation .)

My advice would be to create a script that runs the node. In a Dockerfile I made for running multiple nodes in a single container, I am using this:

Where is a script that sets up the nodes.


What the reason you created a container for a local network and not run it directly on the host?

The command is in shell form, so it can’t be that.
I added --clear-data and changed the local address to and now it works.
I’m going to check which one of the two is causing the issue.

One of the reasons is convenience. With Docker it is easy to launch a self-contained network that isn’t influenced by previous iterations. It could also be used to play a part in CI and testing.

Good point, I missed that! I’m very curious now to as to what causes your problem. Have you checked outside of Docker if you can reproduce with sn_node?


With the latest sn_node (0.46.4), I get the following (after replacing --skip-igd with --skip-auto-port-forwarding):

# sn_node -vv --idle-timeout-msec 5500 --keep-alive-interval-msec 4000 --skip-auto-port-forwarding --local-addr --public-addr --first
error: Invalid value for '--public-addr <public-addr>': Cannot use loopback IP for public address. You can drop this option for a local-only network.

The error format differs from your original post, but I guess the error makes sense and should not be used as a public IP.

It’s local address being the lan ip 192.168.x.x that’s not working I just found.
Does the newest sn_node version work?

This topic was automatically closed after 60 days. New replies are no longer allowed.