|
| 1 | +--- |
| 2 | +title: owasp juice shop > run as container |
| 3 | +categories: owasp juice shop |
| 4 | +--- |
| 5 | + |
| 6 | +Let's run the juice shop as a docker container on our local system, you should have already |
| 7 | +installed docker to perform this exercise. |
| 8 | + |
| 9 | +Check if docker is installed, I have the following version. |
| 10 | +``` |
| 11 | +$ docker -v |
| 12 | +Docker version 19.03.13, build cd8016b6bc |
| 13 | +``` |
| 14 | + |
| 15 | +Pull the juice shop docker image from docker hub. |
| 16 | +``` |
| 17 | +$ docker pull bkimminich/juice-shop |
| 18 | +Using default tag: latest |
| 19 | +latest: Pulling from bkimminich/juice-shop |
| 20 | +ddad3d7c1e96: Pull complete |
| 21 | +3a8370f05d5d: Pull complete |
| 22 | +71a8563b7fea: Pull complete |
| 23 | +119c7e14957d: Pull complete |
| 24 | +21fe34ef8841: Pull complete |
| 25 | +501f36819cdc: Pull complete |
| 26 | +ada263f3355f: Pull complete |
| 27 | +bea7f14d7e5f: Pull complete |
| 28 | +Digest: sha256:8abf7e5b28b5b0e3e2a88684ecac9dc9740643b46e17a4edc9fc16141289869b |
| 29 | +Status: Downloaded newer image for bkimminich/juice-shop:latest |
| 30 | +docker.io/bkimminich/juice-shop:latest |
| 31 | +``` |
| 32 | + |
| 33 | +We can now see this image in our local registry. |
| 34 | +``` |
| 35 | +$ docker image ls bkimminich/juice-shop |
| 36 | +REPOSITORY TAG IMAGE ID CREATED SIZE |
| 37 | +bkimminich/juice-shop latest 3ed777581dce 5 weeks ago 488MB |
| 38 | +``` |
| 39 | + |
| 40 | +Let's run it, on the localhost port 8000, which maps to the container port 3000. |
| 41 | +``` |
| 42 | +$ docker run -d -p 8000:3000 bkimminich/juice-shop |
| 43 | +23d947b010d8fe6667bff18bcc67124fbb25e9c70f90a95af49d405939bcf415 |
| 44 | +``` |
| 45 | + |
| 46 | +The container should be running in the background. |
| 47 | +``` |
| 48 | +$ docker container ls |
| 49 | +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 50 | +23d947b010d8 bkimminich/juice-shop "docker-entrypoint.s…" 46 seconds ago Up 44 seconds 0.0.0.0:8000->3000/tcp nice_khorana |
| 51 | +``` |
| 52 | + |
| 53 | +Its running and hence we should be able to access it's UI in the browser on port 8000. |
| 54 | + |
| 55 | + |
| 56 | +The container can be stopped, when required by mentioning the container id with the stop command. |
| 57 | +``` |
| 58 | +$ docker container stop 23d947b010d8 |
| 59 | +23d947b010d8 |
| 60 | +``` |
| 61 | + |
| 62 | +The container doesn't exist any more. |
| 63 | +``` |
| 64 | +$ docker container ls |
| 65 | +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 66 | +$ |
| 67 | +``` |
| 68 | + |
| 69 | +--end-of-post-- |
0 commit comments