Scoutsuite: Docker build broken

Created on 4 Oct 2020  Â·  5Comments  Â·  Source: nccgroup/ScoutSuite

Using latest master branch (commit ad3b8fbaed29c1401fb5ab84bcbaa18ccaea2519), and the instruction at https://github.com/nccgroup/ScoutSuite/wiki/Docker-Image, the docker-compose command (run inside the docker directory) doesn't work.

$ docker-compose up --build 
Creating network "docker_default" with the default driver
Building ncc-scoutsuite
ERROR: Cannot locate specified Dockerfile: src/Dockerfile

After editing the docker-compose.yaml file to refer to Dockerfile instead of src/Dockerfile it progresses further, but still doesn't work:

$ docker-compose up --build 
Building ncc-scoutsuite
Step 1/19 : FROM python:3.8
3.8: Pulling from library/python
57df1a1f1ad8: Pull complete
71e126169501: Pull complete
1af28a55c3f3: Pull complete
03f1c9932170: Pull complete
65b3db15f518: Pull complete
3e3b8947ed83: Pull complete
f156949921a1: Pull complete
1c1931013093: Pull complete
51fff639b6bf: Pull complete
Digest: sha256:1a126607adde46a706e76357c910f36b9f5529fb575d4d86a639a4997daceba7
Status: Downloaded newer image for python:3.8
 ---> bbf31371d67d
Step 2/19 : LABEL maintainer="Jason Ross <[email protected]>"
 ---> Running in 51afb2f0d0f1
Removing intermediate container 51afb2f0d0f1
 ---> 0788fecd18e0
Step 3/19 : ARG VCS_REF
 ---> Running in 5a5dcbda764b
Removing intermediate container 5a5dcbda764b
 ---> fb1ce7f1870e
Step 4/19 : ARG VCS_URL
 ---> Running in d87841908ab6
Removing intermediate container d87841908ab6
 ---> 46495fa68ed2
Step 5/19 : ARG VERSION
 ---> Running in 0718f8f236ba
Removing intermediate container 0718f8f236ba
 ---> ea28115b94bc
Step 6/19 : ARG BUILD_DATE
 ---> Running in a506a7917178
Removing intermediate container a506a7917178
 ---> da7011d9e106
Step 7/19 : ARG VENDOR
 ---> Running in 020e091297e0
Removing intermediate container 020e091297e0
 ---> 294eaf717c25
Step 8/19 : ARG NAME
 ---> Running in 68455862600a
Removing intermediate container 68455862600a
 ---> a1ed4b9f5792
Step 9/19 : ARG DESCRIPTION
 ---> Running in c2ac96086f59
Removing intermediate container c2ac96086f59
 ---> 4b502975bbf3
Step 10/19 : LABEL     org.label-schema.schema-version="1.0"     org.label-schema.build-date=$BUILD_DATE     org.label-schema.name=$NAME     org.label-schema.description=$DESCRIPTION     org.label-schema.vcs-ref=$VCS_REF     org.label-schema.vcs-url=$VCS_URL     org.label-schema.vendor=$VENDOR     org.label-schema.version=$VERSION
 ---> Running in a1323881bc2d
Removing intermediate container a1323881bc2d
 ---> e027ea47fcc0
Step 11/19 : COPY bin /root/bin
ERROR: Service 'ncc-scoutsuite' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder375686869/bin: no such file or directory

It looks like it's trying to refer to a lot of the scripts that were here: https://github.com/rossja/ncc-scoutsuite/tree/master/src/bin

But they're not in this repo.

Trying to run @rossja's Docker image from https://hub.docker.com/r/rossja/ncc-scoutsuite shows that it is still version 5.9.1:

# /root/scoutsuite/bin/scout --version 
Scout Suite 5.9.1

Therefore if you want to run version 5.10.0 with Docker, it can't currently be done without having to fix up various things first.

Please let me know if there's any further information you need. Thanks.

bug potential

Most helpful comment

I'm reproducing this. The problem is, the context is set to "src", but then the dockerfile: src/Dockerfile.
So docker-compose will look in src/src/Dockerfile which doesn't exist.

    build:
      context: src
      dockerfile: src/Dockerfile

File structure is

tree docker

src
src/Dockerfile
config
docker-compose.yaml

If you change the context to

   build:
      context: .
      dockerfile: src/Dockerfile

then that first error goes away.

The wiki should mention that if building the container without docker-compose, i.e. docker build . you first need to source config/build.env.

Then you will hit errors that the bin directory is not present. Earlier branches of the docker support had a bin directory which is COPY'd in the Dockerfile. That dir is no longer present. I copied it into place and then had to change one of the names container-install-prereq.sh to container-install-additional.sh.
Then the build works.

All 5 comments

@rossja?

yeah, idk. i'll take a look and see what's up.

On Sun, Oct 4, 2020 at 6:01 AM Xavier Garceau-Aranda <
[email protected]> wrote:

@rossja https://github.com/rossja?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nccgroup/ScoutSuite/issues/882#issuecomment-703231792,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABYKFJ3L22MXBAKCX5ULD3SJBBW3ANCNFSM4SDJPLBQ
.

I'm reproducing this. The problem is, the context is set to "src", but then the dockerfile: src/Dockerfile.
So docker-compose will look in src/src/Dockerfile which doesn't exist.

    build:
      context: src
      dockerfile: src/Dockerfile

File structure is

tree docker

src
src/Dockerfile
config
docker-compose.yaml

If you change the context to

   build:
      context: .
      dockerfile: src/Dockerfile

then that first error goes away.

The wiki should mention that if building the container without docker-compose, i.e. docker build . you first need to source config/build.env.

Then you will hit errors that the bin directory is not present. Earlier branches of the docker support had a bin directory which is COPY'd in the Dockerfile. That dir is no longer present. I copied it into place and then had to change one of the names container-install-prereq.sh to container-install-additional.sh.
Then the build works.

I would also suggest that copying the bin directory at docker-compose up time is a dev pattern, not a prod pattern because it makes the container mutable. In this case, I usually split into

  • docker-compose-dev.yml
    mount in the volume as currently done (good if you are developing the docker build stuff)
    However, if you are developing scoutsuite code, you have a long loop of rebuilding the container each time
    you modify code. You really want to run docker-compose --build from the top level directory so you can develop
    inside the container. The easiest way to do this to move the docker-compose.yaml to the top level directory so you can mount in the Scoutsuite/Scoutsuite folder.

  • docker-compose-prod.yml, Dockerfile.prod
    Nothing is mounted into the container and the Dockerfile pip installs from pypy not with COPY.

See https://github.com/MartinHeinz/python-project-blueprint for a good blueprint of doing this.

This should have been fixed in 5.10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alitheg picture alitheg  Â·  8Comments

x4v13r64 picture x4v13r64  Â·  7Comments

sidewinder31 picture sidewinder31  Â·  6Comments

x4v13r64 picture x4v13r64  Â·  8Comments

JLLeitschuh picture JLLeitschuh  Â·  4Comments