Docker Compose Installation Guide¶
This document provides detailed steps for deploying New API using Docker Compose.
Prerequisites¶
- Docker and Docker Compose installed
- Recommended system: Linux (Ubuntu/CentOS/Debian, etc.)
Deploying with Docker Compose¶
Method 1: Using Git Clone (Recommended)¶
If you can access GitHub normally, this method is recommended:
# Download project source code
git clone https://github.com/Calcium-Ion/new-api.git
# Enter project directory
cd new-api
Method 2: Manually Creating Configuration Files¶
If you cannot access GitHub or clone the repository, you can manually create configuration files:
- Create a directory for New API deployment:
- Create a
docker-compose.yml
file in this directory
You can refer to the configuration examples in the Docker Compose Configuration Guide document and choose based on your needs:
- Production environment: Recommended to use complete configuration (including MySQL and Redis)
-
Testing environment: Can use simplified configuration
-
Create the file using a text editor:
Copy the selected configuration content to this file and customize it as needed.
Starting Services¶
After the configuration file is ready, whether you cloned via Git or created manually, you can use the following command to start services:
This command will automatically pull the required images and start services in the background.
Viewing Logs¶
- All services (follow)
- Logs of a specific service (examples:
new-api
,mysql
,redis
)
- Show only the latest N lines
- Show logs since a time window
- Include timestamps
- Foreground mode debugging (stream logs while starting)
Press Ctrl+C to exit foreground mode (the service will stop). Use -d
for background mode.
- List services/status
- Using container name to view logs (when
container_name
is set, e.g.,new-api
)
Stopping Services¶
Accessing the System¶
After services start successfully, visit http://server-IP:3000
. You will be guided to the initialization page to create the admin account and password (only required on first installation). After initialization, log in with the credentials you created.