You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile in an empty directory with the following content:
| #!/bin/bash | |
| set -o errexit | |
| echo "Removing exited docker containers..." | |
| docker ps -a -f status=exited -q | xargs -r docker rm -v | |
| echo "Removing dangling images..." | |
| docker images --no-trunc -q -f dangling=true | xargs -r docker rmi |
| #!/bin/bash | |
| # This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo | |
| # Attempts to cleanly stop and remove all containers, volumes and images. | |
| docker ps -q | xargs --no-run-if-empty docker stop | |
| docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes | |
| docker volume ls -q | xargs --no-run-if-empty docker volume rm | |
| docker images -a -q | xargs --no-run-if-empty docker rmi -f | |
| # Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again. |
| version: "2" | |
| services: | |
| elasticsearch: | |
| image: elasticsearch:6.4.2 | |
| container_name: elasticsearch | |
| ports: | |
| - 9200:9200 | |
| - 9300:9300 | |
| volumes: | |
| - ./esdata/:/usr/share/elasticsearch/data |
You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile in an empty directory with the following content: