Soluto/mobsf-ci

MobSF request failed due to unknwon error Failed to open TCP connection to mobsf:8000

mengdd opened this issue · 2 comments

Hi, I'm trying the steps in readme.
When I run:

TARGET_PATH='target/app.apk' docker-compose up --build --exit-code-from scan

I got:

WARNING: using --exit-code-from implies --abort-on-container-exit
Building scan
Step 1/6 : FROM ruby:2.5-alpine
 ---> beb4ca09a656
Step 2/6 : WORKDIR /app
 ---> Using cache
 ---> bbf58396d1c7
Step 3/6 : COPY Gemfile Gemfile.lock /app/
 ---> Using cache
 ---> da41bb337e33
Step 4/6 : RUN bundle && apk add --update bash
 ---> Using cache
 ---> 58fcd3f38a5f
Step 5/6 : COPY . .
 ---> Using cache
 ---> 87e8a32cb5dd
Step 6/6 : CMD ./wait-for-it.sh mobsf:8000 -- ruby scan.rb
 ---> Using cache
 ---> 1aa9faf841e7
Successfully built 1aa9faf841e7
Successfully tagged mobsf-ci_scan:latest
Recreating mobsf-ci_scan_1 ... done
Starting mobsf-ci_mobsf_1  ... done
Attaching to mobsf-ci_mobsf_1, mobsf-ci_scan_1
scan_1   | timeout: unrecognized option: t
scan_1   | BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.
scan_1   |
scan_1   | Usage: timeout [-s SIG] SECS PROG ARGS
scan_1   |
scan_1   | Runs PROG. Sends SIG to it if it is not gone in SECS seconds.
scan_1   | Default SIG: TERM.
scan_1   | wait-for-it.sh: timeout occurred after waiting 15 seconds for mobsf:8000
scan_1   | Starting to scan "target/app.apk"
scan_1   | MobSF request failed due to unknwon error Failed to open TCP connection to mobsf:8000 (Connection refused - connect(2) for "mobsf" port 8000)
mobsf-ci_scan_1 exited with code 1
Aborting on container exit...
Stopping mobsf-ci_mobsf_1  ... done

What's the problem? Am I missing something?

Finally, I got this issue resolved by changing the docker-compose.yml:
use the latest image and add a depends_on:

version: '3'

services:
  mobsf:
    image: opensecurity/mobile-security-framework-mobsf:latest
    environment:
      - MOBSF_API_KEY=12345
    ports:
     - 8000:8000
  
  scan:
    build:
      context: ./scan
    environment:
      - MOBSF_URL=http://mobsf:8000/
      - TARGET_PATH=${TARGET_PATH}

    volumes:
      - "$PWD/output:/app/output"
      - "$PWD/target:/app/target"

    depends_on:
      - mobsf

PR raised at: #5