Borjis131 / docker-open5gs

Open5GS 5G Core Docker images and Docker compose deployments
GNU Affero General Public License v3.0
30 stars 15 forks source link

Error encountered while running docker-open5gs #7

Closed prabhumanguluru closed 9 months ago

prabhumanguluru commented 10 months ago

While running the following command in Ubuntu 22.04 terminal sudo docker compose -f compose-files/basic/docker-compose.yaml --env-file=.env up -d

Output Error response from daemon: driver failed programming external connectivity on endpoint upf (6774019c3e494d67d275329c5c03a7fe9682a6cb454b71a82377b8bf7271c2f8): Error starting userland proxy: listen udp4 0.0.0.0:2152: bind: address already in use

_i have changed host_IP_address several times with different IPaddress values but i have encountered the following above error repeteadly

Borjis131 commented 10 months ago

Hello @prabhumanguluru,

Seems like something is already using port 2152 in your machine. That conflicts with the docker-compose.yaml line:

...
upf:
...
    ports:
      - "0.0.0.0:2152:2152/udp"

Because it tries to open the UPF 2152 on all the host's IP addresses. Try to modify the docker-compose.yaml file to only use one IP address and try it again.

If you have a single IP address in your machine, add a new one to the same interface and try with that.

Hope everything is clear!

prabhumanguluru commented 10 months ago

could you tell me the change where the modification has to be done

Borjis131 commented 10 months ago

Check your machine network configuration (this can be done with the command ip address from the ìproute2 package)

If your machine has more than one interface (skip the lo and docker0 interfaces) note the IP addresses after the inet keyword, those are the IP addresses configured in your machine.

# Example output
1: lo: ...
2: ens18: ...
    inet 172.31.2.196/16
3: docker0: ...

You will need two of them, if you only have one interface in your machine check how to create a linux sub-interface on Google (there is a lot of linux distros and network configurations so I cannot guide you here).

After getting the two IP addresses, use the one being used for the DOCKER_HOST_IP in your docker-compose.yaml file. Modify the ports field as I commeted previously for DB, AMF and UPF. Change the 0.0.0.0 for that IP. From:

...
upf:
...
    ports:
      - "0.0.0.0:2152:2152/udp"

To:

...
upf:
...
    ports:
      - "172.31.2.196:2152:2152/udp"

Assuming DOCKER_HOST_IP=172.31.2.196 in my particular case.

Use the second IP address for the other thing that is running on port 2152.

prabhumanguluru commented 10 months ago

@Borjis131 so the changes i need to made in .env file and docker-compose.yaml file and do i need to give the same address for both

Borjis131 commented 10 months ago

@prabhumanguluru thats it. And the software that is currently opening port 2152 on your machine should use a different IP address that the one being used in the .env and docker-compose.yaml.

prabhumanguluru commented 9 months ago

@Borjis131 I have made the changes as you said but again i am getting the same error as mentioned above

Borjis131 commented 9 months ago

@prabhumanguluru you have two IP addresses in the same machine as I said or you only changed the IP addresses where I told you? Because if you only have one IP address you will have the same problem always.

Also, it would help me understand what you are trying to do if you told me what is the software that is opening the port 2152 in your machine. Are you running a different 5G core, gNB or emulator on the same machine?

prabhumanguluru commented 9 months ago

@Borjis131 i am using ubuntu 22.04 in virtualbox on windows 11 laptop, so could you tell me ip address that i need to use

Borjis131 commented 9 months ago

@prabhumanguluru I can't help you if you don't follow the steps that I am trying to explain to you.

This is an issue regarding your specific deployment and not docker-open5gs.

Ubuntu 22.04 uses netplan for the network configuration, check this, add the last part to your ethernets section, adding the same interface name in your configuration but with :0 in the name and giving an IP address to this new sub-interface.

The file is located at /etc/netplan/ and you apply it by executing sudo netplan apply in the command line.

Note: Keep in mind that this configuration can break your current VM network setup, so do it at your own risk.

Also there is something running on port 2152 in your machine, it would be useful to know what. Run:

sudo lsof -i:2152

And show me the output.

prabhumanguluru commented 9 months ago

Screenshot from 2024-01-16 16-15-52

Borjis131 commented 9 months ago

@prabhumanguluru seems like your machine is already running Open5GS. Kill all the processes shown in the image and start the docker compose again.

sudo kill -9 <pid>

Where pid is the column named PID in your screenshot. Then run the basic docker-open5gs example again.

Note: If you installed Open5GS with the systemd services you will have to stop and disable the services, otherwise everytime you reboot the machine, systemd will start them.

prabhumanguluru commented 9 months ago

@Borjis131 i have done as you said and there were no issues Screenshot from 2024-01-18 10-59-59

prabhumanguluru commented 9 months ago

So is that it do i need to run any other setup

Borjis131 commented 9 months ago

Each setup consists of a different 5G core network configuration, they are explained in the docs/ section of the project. Feel free to try them and experiment. I will close this issue cause it has been solved.