<p>You can dockerize/containerize pretty much anything fairly easily.  You basically just have to add a Dockerfile that:</p>

<ul>
<li>Inherits from some base image;  this provides the basic OS features and whatever else you need.  E.g. a Java app may inherit from alpine-jdk-8 (a slim linux type image) that comes pre-bundled with the Java Development Kit.</li>
<li>Copies in your code and any dependencies.</li>
<li>Sets any variables you require.</li>
<li>Exposes any ports your app needs (e.g. ports 80/443 for serving a web page).</li>
<li>Mounts any volumes to save permanent data.  Generally anything in a container is ephemeral;  it will be gone when the container dies.  So, if you want to save/export results permanently you can mount a volume for, say, your local computer's file system, or for an amazon s3 bucket, or whatever.</li>
<li>Specifies how to start the app (the entry point).</li>
</ul>

<p>Here's an example for arbitrary python scripts; but it's the same deal for any other language/tool:</p>

<p><a href="https://runnable.com/docker/python/dockerize-your-python-application" rel="nofollow noreferrer">https://runnable.com/docker/python/dockerize-your-python-application</a></p>

<p>If you're taking an existing executable which may  be your case, you just do the same thing but instead of loading in your code, you load in the binary and set that as your entry point.</p>

<p>The container lives until the entry point program ends.  So, some containers can be short lived - like just executing a CURL or something.  Some are permanent until they  die/are killed (e.g. a web service).</p>

<p>Again, to save state/results, unless you're writing them to a database or some other external system, you will want to mount a volume.</p>

<p>You build your Dockerfile into an image with a docker build command; then it will show up in your local docker image registry (<code>docker image ls -a</code>).  After that, you can run it with a standard docker run command (where you will likely want to expose any ports/etc that are needed).  I assume you're good with this one since you already run existing images in docker.</p>

<p>Generally you will need to store your image in a registry so you can use it on/from other systems.  But if running it locally is all you need you're done now :).</p>

<p>You can store your own containers in DockerHub or in Amazon AWS ECR or in any other number of options if you require a registry.</p>

CC BY-SA 4.0
2020-02-09T19:23:45.343Z
2020-02-09T19:23:45.343Z
John Humphreys
<p>I'm new to docker/Jenkins and would like a hand understanding something I'd like to practice.</p>

<p>I'm trying to set up a tool (like owasp-zap) and using it to run against a container built of an intentionally vulnerable website (like owasp-juice shop). Then saving those results. My only experience in Docker is grabbing an existing image and running the container locally. I'm struggling to find docs about this and could use some guidance.</p>

<docker>
Dockerizing a tool to test web apps?
TinCan
# Dockerizing a tool to test web apps?

(Asked by: username_0 on 2020-02-08)

I'm new to docker/Jenkins and would like a hand understanding something I'd like to practice.

I'm trying to set up a tool (like owasp-zap) and using it to run against a container built of an intentionally vulnerable website (like owasp-juice shop). Then saving those results. My only experience in Docker is grabbing an existing image and running the container locally. I'm struggling to find docs about this and could use some guidance.

**Tags:** docker


---

## 1 answers

### Answer by username_1 on 2020-02-09. Score: 2 | Accepted answer

You can dockerize/containerize pretty much anything fairly easily. You basically just have to add a Dockerfile that:

* Inherits from some base image; this provides the basic OS features and whatever else you need. E.g. a Java app may inherit from alpine-jdk-8 (a slim linux type image) that comes pre-bundled with the Java Development Kit.
* Copies in your code and any dependencies.
* Sets any variables you require.
* Exposes any ports your app needs (e.g. ports 80/443 for serving a web page).
* Mounts any volumes to save permanent data. Generally anything in a container is ephemeral; it will be gone when the container dies. So, if you want to save/export results permanently you can mount a volume for, say, your local computer's file system, or for an amazon s3 bucket, or whatever.
* Specifies how to start the app (the entry point).

Here's an example for arbitrary python scripts; but it's the same deal for any other language/tool:

<https://runnable.com/docker/python/dockerize-your-python-application>

If you're taking an existing executable which may be your case, you just do the same thing but instead of loading in your code, you load in the binary and set that as your entry point.

The container lives until the entry point program ends. So, some containers can be short lived - like just executing a CURL or something. Some are permanent until they die/are killed (e.g. a web service).

Again, to save state/results, unless you're writing them to a database or some other external system, you will want to mount a volume.

You build your Dockerfile into an image with a docker build command; then it will show up in your local docker image registry (`docker image ls -a`). After that, you can run it with a standard docker run command (where you will likely want to expose any ports/etc that are needed). I assume you're good with this one since you already run existing images in docker.

Generally you will need to store your image in a registry so you can use it on/from other systems. But if running it locally is all you need you're done now :).

You can store your own containers in DockerHub or in Amazon AWS ECR or in any other number of options if you require a registry.


---

