AI generated prompt for Docker Compose Multi-Service Setup
**Context**:
Docker Compose is a tool for defining and running multi-container Docker applications. It allows users to define a configuration file, typically named `docker-compose.yml`, which describes the services, networks, and volumes that make up the application. In a multi-service setup, multiple containers are launched and managed together, enabling complex applications to be deployed and managed as a single entity.
**Detailed Instructions**:
Create a Docker Compose configuration for a multi-service application consisting of a web server, a database, and a caching layer. The web server should use the latest version of the official Python image and expose port 80. The database should use the latest version of PostgreSQL and persist data in a named volume. The caching layer should use Redis and expose port 6379. Ensure that all services can communicate with each other over a custom network named "app-net". Define environment variables for the database connection in the web server service.
The configuration should include:
- Service definitions for the web server, database, and caching layer.
- A custom network named "app-net" for service communication.
- A named volume for persisting database data.
- Environment variables for database connection settings in the web server service.
- Port mappings for exposing the web server and caching layer services.
**Output Format**:
The output should be a complete `docker-compose.yml` file that can be used to create and start the multi-service application. The file should be formatted in YAML and include all necessary configuration options as specified in the instructions.
**Examples**:
For reference, a simple service definition in Docker Compose might look like:
```yml
version: '3'
services:
web:
image: python:latest
ports:
- "80:80"
```
However, the final output should include all services (web server, database, caching layer), the custom network, named volume, environment variables, and port mappings as detailed in the instructions.This coding prompt is designed to help you get better results from AI assistants like ChatGPT, Claude, and Gemini. Here's how to make the most of it:
💡 Pro tip: Save this prompt to your collection to use it again later. Well-crafted prompts can save hours of back-and-forth with AI.
Adjust the prompt to match your specific industry, audience, or use case. Adding relevant context improves output quality.
Specify your desired output length (e.g., "in 200 words" or "in 3 bullet points") to get more targeted responses.
Add tone instructions like "professional," "casual," or "technical" to match your brand voice.
Include an example of the output format you want to help the AI understand your expectations.
This prompt has been tested and optimized for all major AI models. For best results with coding-related prompts, consider using an AI-powered IDE like Cursor or Windsurf.
Learn more about using prompts effectively with our comprehensive guides:
0 people found this prompt helpful
Based on 0 reviews
Be the first to share your experience with this prompt!
This prompt was reviewed and verified to work with current AI models.
Tested with ChatGPT, Claude & Gemini. Reviewed by community users.
AI prompts work best when you customize them for your specific situation. Follow these steps to get the most out of Docker Compose Multi-Service Setup.