Docker Community Forums

Share and learn in the Docker community.

Docker container with command from jenkins no output

docker

(Hackityann) #1

Hi all,

I am working on a project to implement a security pipeline with jenkins/docker/owaspZAP.
What I want to do is from jenkins to run a kali or owasp zap docker container with the command that starts the OWASP ZAP API and then copy a python script to the container and run that script.

The problem I am facing now is that jenkins runs the docker container fine, but stops at the fact that the running of the headless API gives back output that stays forever (as it logs directly to terminal). So what I want to know is:
Is there anyway to run a docker container with commands without it giving any output but the name of the container?

Specifically I am running the following command:
docker run --name zappy owasp/zap2docker-stable zap.sh -daemon

Thank you for your replies

Kind regards,


(Andnik) #2

Have similar problem.
Your question is: “Is there anyway to run a docker container with commands without it giving any output but the name of the container?”

Have you tried to run command in deattached mode adding -d flag to your command? it will run in background thread, but will return container identifier.

Then you can add --rm if you want to container being removed automatically when it finishes.

And you can use “docker wait” and passing your container id to wait for container to finish.

Hope that helps.