| layout | page |
|---|---|
| title | Docker Deployment Guide |
| permalink | /tutorials/docker-deploy/ |
This tutorial provides step-by-step instructions for deploying common security tools using Docker, making it easier to set up and maintain your security infrastructure.
Before you begin, ensure you have the following installed:
- Docker Engine (version 20.10.x or later)
- Docker Compose (version 2.x or later)
- Basic understanding of Docker concepts
- At least 4GB of RAM and 20GB of free disk space
First, let's ensure Docker is properly configured for security:
# Create a dedicated network for security tools
docker network create security-tools-network
# Set up a volume for persistent data
docker volume create security-dataWazuh is a free, open-source security monitoring solution that provides threat detection, integrity monitoring, and compliance capabilities.
version: '3.9'
services:
wazuh:
image: wazuh/wazuh:4.3.10
hostname: wazuh-manager
restart: always
ports:
- "1514:1514"
- "1515:1515"
- "514:514/udp"
- "55000:55000"
volumes:
- wazuh-config:/var/ossec/etc
- wazuh-logs:/var/ossec/logs
- wazuh-queue:/var/ossec/queue
- wazuh-var:/var/ossec/var
- wazuh-integrations:/var/ossec/integrations
- wazuh-active-response:/var/ossec/active-response
- wazuh-agentless:/var/ossec/agentless
- wazuh-wodles:/var/ossec/wodles
- filebeat-etc:/etc/filebeat
- filebeat-var:/var/lib/filebeat
networks:
- security-tools-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
restart: always
environment:
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "bootstrap.memory_lock=true"
- "discovery.type=single-node"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elastic-data:/usr/share/elasticsearch/data
networks:
- security-tools-network
kibana:
image: docker.elastic.co/kibana/kibana:7.17.0
restart: always
depends_on:
- elasticsearch
ports:
- "5601:5601"
environment:
- "ELASTICSEARCH_HOSTS=http://elasticsearch:9200"
networks:
- security-tools-network
volumes:
wazuh-config:
wazuh-logs:
wazuh-queue:
wazuh-var:
wazuh-integrations:
wazuh-active-response:
wazuh-agentless:
wazuh-wodles:
filebeat-etc:
filebeat-var:
elastic-data:
networks:
security-tools-network:
external: truedocker-compose up -dOpen your browser and navigate to http://your-server-ip:5601. The default credentials are:
- Username:
elastic - Password:
changeme
OpenVAS is a full-featured vulnerability scanner that helps identify security issues in your systems.
version: '3.9'
services:
openvas:
image: securecompliance/gvm:latest
restart: always
ports:
- "8080:9392"
environment:
- USERNAME=admin
- PASSWORD=admin
- RELAYHOST=smtp.example.com
- SMTPPORT=25
volumes:
- openvas-data:/data
networks:
- security-tools-network
volumes:
openvas-data:
networks:
security-tools-network:
external: truedocker-compose up -dThe initial setup may take 15-30 minutes. Once complete, access the dashboard at http://your-server-ip:8080. Use the credentials specified in the docker-compose file.
ModSecurity is a powerful web application firewall that protects your web applications from various attacks.
version: '3.9'
services:
modsecurity:
image: owasp/modsecurity-crs:3.3.2-apache
restart: always
ports:
- "80:80"
- "443:443"
environment:
- PROXY_TIMEOUT=300
- PARANOIA=1
- ANOMALY_INBOUND=5
- ANOMALY_OUTBOUND=4
volumes:
- modsec-logs:/var/log/apache2
networks:
- security-tools-network
volumes:
modsec-logs:
networks:
security-tools-network:
external: truedocker-compose up -dUpdate your application's configuration to point to the ModSecurity container as a reverse proxy.
-
Container fails to start
- Check logs:
docker logs <container_name> - Verify resource allocation:
docker stats
- Check logs:
-
Network connectivity issues
- Ensure the security-tools-network exists:
docker network ls - Check container network settings:
docker inspect <container_name> | grep -A 20 "Networks"
- Ensure the security-tools-network exists:
-
Data persistence issues
- Verify volume mounting:
docker inspect <container_name> | grep -A 10 "Mounts" - Check volume permissions:
docker exec <container_name> ls -la /path/to/mounted/volume
- Verify volume mounting:
-
Container Hardening
- Use official images from trusted sources
- Regularly update container images
- Run containers with minimal privileges
-
Network Security
- Limit exposed ports to only what's necessary
- Use internal Docker networks for inter-container communication
- Implement network segmentation
-
Data Protection
- Encrypt sensitive data in volumes
- Implement proper backup procedures for volumes
- Regularly audit access to data volumes
- Integrate deployed tools with your existing security infrastructure
- Set up automated updates for container images
- Implement monitoring for container health and performance
- Explore advanced deployment options with Kubernetes for larger environments
By following this tutorial, you've successfully deployed essential security tools using Docker, providing a solid foundation for your security monitoring and protection capabilities.