skip to Main Content

I am preparing a test automation which require me to install network manager so that the code api(which uses python3-networkmanager) could be tested.

In the docker file, I tried installing:

apt-get install dbus 
                network-manager

start receiving error:

networkmanager.systems do not have hostname property. 

I looked for solutions, but appears that will require:

  1. Privilege user (cannot use privilege user, project requirement)
  2. Reboot after installing same. (in docker, hence, can’t reboot)

This leaves me with an only option for mocking debian networkmanager that can communicate with python3-networkmanager.

Trying to figure out, how I can mock same?

2

Answers


  1. RUN apt-get update && apt-get install -y 
        network-manager
    

    worked for me.

    Login or Signup to reply.
  2. I would like to contribute as I had to spend some time getting it to work.

    Inside the dockerfile you have to add:

    RUN apt-get update && apt-get install -y network-manager dbus
    

    Also, I added a script to start the network manager:

    #!/bin/bash
    
    service dbus start
    service NetworkManager start
    

    Then in the Dockerfile you have to call this start script at the end:

    COPY start_script.sh /etc/init/
    ENTRYPOINT ["/etc/init/start_script.sh"]
    

    Now you can build your container and run it like this:

    docker run --net="host" -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket container
    

    For me, it is enough to work with OrangePi and Docker without a privileged container.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search