Sorry to confuse you! I’ll explain my work in detail.
Here is my docker-compose.yml file.
As you can see, there are two services. One of them is for a web container(django).
This web docker image is built based on Dokcerfile-dev.
I have already run two containers using docker-compose up -d --build command. They’re working well.
I want to install and run wifi-connect inside the web container(django). In order to do that, I added a volume and environment to docker-compose.yml file as follows.
And I added RUN apt-get install -y systemd and RUN apt-get install -y dbus to Dockerfile for the web container because systemd and dbus are needed to install wifi-connect.
Here is Dockerfile for the web container.
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 dbus
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
RUN chmod +x raspbian-install.sh
RUN chmod 774 docker-entrypoint.sh
ENTRYPOINT ["bash", "docker-entrypoint.sh"]
As you can see, the web container includes balena-io/wifi-connect git source.
After building the docker image using docker-compose up -d --build command, two containers are working well.
I went into the django container and tried to install and run wifi-connect.
The problem is from now on.
When I run raspbian-installer.sh file in django container, I got the following error.
pi@raspberrypi:~/DTECTS_SW_Server_Side $ docker exec -it d8426c7fa4c8 /bin/bash
root@d8426c7fa4c8:/app# bash wifi-connect/scripts/raspbian-install.sh
WiFi Connect Raspbian Installer: Retrieving latest release from https://api.github.com/repos/balena-io/wifi-connect/releases/latest...
WiFi Connect Raspbian Installer: Downloading and extracting https://github.com/balena-io/wifi-connect/releases/download/v4.4.4/wifi-connect-v4.4.4-linux-rpi.tar.gz...
WiFi Connect Raspbian Installer: Successfully installed wifi-connect 4.4.4
Failed to connect to bus: Connection refused
WiFi Connect Raspbian Installer: command failed: systemctl -p LoadState --value show NetworkManager
I have already installed wifi-connect on hostOS (raspbian). I think it means that NetworkManager has been already installed. And as I mentioned above, I mounted dbus in host OS to dbus in the container.
But I still have the same error.
I hope the above explanation helps you understand my problems
How can I solve this problem?
If you are not sure, please let me know.