Docker Community Forums

Share and learn in the Docker community.

Docker Container issues

I am new to docker and have docker installed and two containers (Owasp-Zap, DVWS).
I am using Zap Baseline to perform scan on DVWS but I have an error that the scan name is not a container.

TASK [getting raw output of the scan] ******************************************************
fatal: [my_vm_06]: FAILED! => {“changed”: true, “cmd”: [“docker”, “logs”, “-f”, “owasp-zap-full-scan-dvws”], “delta”: “0:00:00.403520”, “end”: “2021-05-02 18:44:39.104478”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2021-05-02 18:44:38.700958”, “stderr”: “Error: No such container: owasp-zap-full-scan-dvws”, “stderr_lines”: [“Error: No such container: owasp-zap-full-scan-dvws”], “stdout”: “”, “stdout_lines”: }

This is my playbook:

  • name: Running OWASP ZAP Baseline Scan
    hosts: localhost
    gather_facts: no
    become: yes
    vars_files:
    • var_zapbaseline.yml
      tasks:
    • vmware_guest:
      hostname: “{{ VMWARE_HOST }}”
      username: “{{ VMWARE_USER }}”
      password: “{{ VMWARE_PASSWORD }}”
      validate_certs: no
      folder: /ha-datacenter/vm/
      name: my_vm_06
  • name: run zap baseline
    hosts: my_vm_06
    remote_user: “{{ remote_user_name }}”
    gather_facts: no
    vars:
    remote_user_name: kali-user
    owasp_zap_image_name: owasp/zap2docker-weekly
    website_url: http://0.0.0.0:80
    reports_location: ~/Documents/scans
    scan_name: owasp-zap-full-scan-dvws
    tasks:
    • name: running owasp zap full scan container against “{{ website_url }}”
      docker_container:
      name: “{{ scan_name }}”
      image: “{{ owasp_zap_image_name }}”
      interactive: yes
      auto_remove: yes
      state: started
      volumes: “{{ reports_location }}:/zap/wrk:rw”
      command: “zap-full-scan.py -t {{ website_url }} -r {{ scan_name }}_report.html”
    • name: getting raw output of the scan
      command: “docker logs -f {{ scan_name }}”
      register: scan_output
    • debug:
      msg: “{{ scan_output }}”