Docainer is a command-line tool that generates production-ready Dockerfile
and docker-compose.yml
files from predefined templates using a simple configuration file.
Currently supported on Linux only.
- Introduction
- Features
- Installation
- Usage
- Configuration
- Supported Stacks
- Generated Dockerfile Template
- Generated Docker Compose Template
- Contributing
- License
Docainer helps developers quickly scaffold Docker configurations for web projects (e.g., Django, React, Next.js) using minimal YAML configuration. It is optimized for production environments.
- Auto-generates Dockerfile and docker-compose.yml
- Based on customizable Jinja2 templates
- Stack-aware (supports Django, React, Next.js, and more)
- Production-ready structure
- CLI-based interactive selection
Ensure Python 3.10+ and a Linux OS.
git clone https://github.com/hwisnu222/docainer.git
cd docainer
make build
cd dist/
chmod +x docainer
sudo mv docainer /usr/local/bin/
This will produce a binary file named docainer
.
Download the latest release and install it globally:
curl -fsSL https://raw.githubusercontent.com/hwisnu222/docainer/main/install.sh | sh
wget -qO - https://raw.githubusercontent.com/hwisnu222/docainer/main/install.sh | sh
Now you can run it from anywhere:
docainer
To run the generator:
docainer
You will be prompted to choose a stack. The tool will then generate the corresponding Dockerfile and docker-compose.yml files in your current directory.
Stacks are defined in config.yaml
. Example configuration:
reactjs:
dockerfile:
base_image: node:20-alpine
nginx_image: nginx:stable-alpine
compose:
service_name: "react-app"
port: 3000
container_port: 80
You can add more stacks using the same structure.
- Django
- ReactJS
- NextJS
You may add more by creating new folders inside the templates/
directory.
FROM {{ base_image }}
WORKDIR /app
COPY . .
RUN {{ install_command }}
CMD [ "{{ run_command }}" ]
version: "3"
services:
{{ service_name }}:
build:
context: .
dockerfile: Dockerfile
ports:
- "{{ port }}:{{ container_port }}"
You are welcome to contribute by opening issues or pull requests.
This project is licensed under the MIT License.