I’m struggling with installing Balena wifi-connect inside Django container running on Raspberry Pi.
I downloaded the following git repository on Raspberry Pi4.
This works well outside the docker container, but I want to install and run it inside the web docker container. I don’t want to have it that works as an container. I just want to install and use it in a web container that is already running. I burnt the latest version of RaspbianOS (32bit lite version) on Pi.
Here is Dockerfile for django container.
FROM python:3.7.3
ENV PYTHONUNBUFFERED=0
WORKDIR /app
ADD requirements.txt /app/
RUN pip3 install -r requirements.txt
RUN pip3 install netifaces
RUN apt-get install -y systemd
RUN apt-get install -y supervisor
RUN service supervisor restart
COPY . /app
ADD uart.conf /etc/supervisor/conf.d
ADD net_monitor.conf /etc/supervisor/conf.d
WORKDIR /app/wifi-connect/scripts
RUN chmod +x raspbian-install.sh
RUN ./raspbian-install.sh
WORKDIR /app
RUN chmod 774 docker-entrypoint.sh
ENTRYPOINT ["bash", "docker-entrypoint.sh"]
When I run raspbian-install.sh in the container, I got the following error.
I have already met with two errors and solved them by installing systemd in the container and deleting all sudo in raspbian-installer.sh file, but I don’t have an idea to solve the above issue.
I’m guessing this is related to the dbus setting on the Raspbian.
I hope you help me about this problem.
Thanks in advance.
Anatoli
Where should I add this command? I just need to run this command inside the docker container? Or should I add this to any file? Should I use the raspberry pi IP as continerIP?
As you can see in my screenshot, I run docker-entrypoint.sh by bash command in the end of my Dockerfile. But I see the user app is run by dbus-run-session command in the guide. Should I also use dbus-run-session command, not bash?
You can skip the copy and entrypoint steps in the guide. The installation of wifi-connect is failing due to dbus not being installed on the image. Try just adding the RUN apt-get install -y dbus line into your Dockerfile and retrying.
You might run into issues running the container, in which case you might want to make the host dbus socket when issuing the docker run in which case you might have to link the host socket into the docker container by adding --mount type=bind,source=/var/run/dbus/system_bus_socket,target=/host/var/run/dbus/system_bus_socket -e DBUS_SYSTEM_BUS_ADDRESS="unix:path=/host/run/dbus/system_bus_socket" to the docker run options.
Thanks for your help.
After installing dbus package in the web container, I retried to install wifi-connect on it. But I still have the same error.
So I’m trying to link the host dbus socket into the web docker container. But I don’t use docker run command to build the docker image and run the containers. I’m running all the docker containers using docker-compose.yml.
Here is my docker-compose.yml.
The dockerfile version I use is 3.0. Does that affect installing wifi-connect into the container?
As you can see, I added a volume to link the host socket into the docker container. I just removed /host in the target. Is it a mistake?
I also added an environment for DBUS_SYSTEM_BUS_ADDRESS. Could you please check if it’s set correctly?
I see type=bind field in docker run options you attached. But I’m not sure how to setup this on my docker-compose.yml. Could you please let me know it?
Is there something specific that you are looking for with version 3? I was taking a look at the docker docs here and there are some new commands there. Is there something in that you are looking at? I know for a fact that some of our projects that use wifi-connect have 2.1 and they work fine.
in the environment you are setting /host/run/dbus whereas in the volumes you have made that var/run/ and removed the host part. I think those two things won’t go well with each other.
Hi @anujdeshpande
Thanks for your help, but I want to install and run wifi-connect inside the web container already running on my pi4. I don’t want the Wi-Fi connection to run as one independent container.
I need the solution to install and run it in the web container.
I’m still waiting for your help.
As you recommended, I first built a web docker image called test:1.0 with the following command.
docker build -t test:1.0 .
After that, I run the container using docker run command with the options you mentioned.
And then I run raspbian-installer.sh file in the container, but I still get the same error.