[BUG] Possible bug with dockerfile
Describe the bug
As @klaalk pointed out there is a problem when running the docker container without having first installed Polycube on the host system.
To Reproduce
Run the container on a system without Polycube installed with command:
docker run -it --rm --privileged --network host -v /proc:/host/proc -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /etc/localtime:/etc/localtime:ro polycubenetwork/polycube:latest
An error will be printed saying no polycubed binary is found.
Expected behavior
Polycube should run properly
Please tell us about your environment:
- OS details: Ubuntu Server 20.04.1 LTS
- Kernel details: 5.4.0-56-generic
- Polycube Version: latest
Additional context
I think the problem is related with the last line of the Dockerfile:
CMD ["nsenter","--mount=/host/proc/1/ns/mnt","polycubed"]
nsenter causes the container to use the File System of the host, therefore running the polycubed binary of the host. If this binary is not found on the FS of the host an error is thrown.
The last line of the Dockerfile is overridden if a command is executed when running the container, for example launching the container with the command of the documentation:
docker run -it --rm --privileged --network host -v /lib/modules:/lib/modules:ro -v /usr/src:/usr/src:ro -v /etc/localtime:/etc/localtime:ro polycubenetwork/polycube:latest /bin/bash -c 'polycubed -d && /bin/bash'
nsenter is not executed and the container runs the internal polycube binary.
Can anyone confirm this problem? I wonder if nsenter can be removed safely (a comment says that it is needed for shadow services)