emsec / hal

HAL – The Hardware Analyzer
MIT License
530 stars 72 forks source link

`install_dependencies.sh` no longer detects Docker context #559

Closed shuyelang closed 2 months ago

shuyelang commented 4 months ago

The docker file needs a little tweak as ubuntu does not come with sudo installed.

To reproduce:

  1. docker build . -t hal
  2. ERROR [ 8/12] RUN ./install_dependencies.sh 2.2s


    [ 8/12] RUN ./install_dependencies.sh:
    2.124 ./install_dependencies.sh: line 73: sudo: command not found

to fix update the docker file to do this:

RUN apt-get update -y && \ apt-get install -y lsb-release && \ apt-get install sudo -y

RenWal commented 4 months ago

This appears to be related to a change in how Docker builds packages. With the legacy builder, I can successfully build the image. However, using the new Buildx engine (on Docker version 25.0.3, build 4debf41), the build fails.

The install_dependencies.sh script is Docker-aware (the check is in line 7), so it should never call sudo in the first place if it recognizes that it is running inside a Docker build context. Installing sudo inside the container is not the right solution for this problem.

I assume that Buildx does something differently from older Docker versions, which breaks the Docker check.