Howto16r1:Step-by-Step Docker Compose Container Deployment
If you have difficulty understanding the written language, we recommend to use www.deepl.com for translation.
If installed, you can also use the translation function of your browser by right-clicking.
This guide explains how to structure, configure, and run a container using Docker Compose. It also covers how to update the container image.
Docker Compose: Step-by-Step Container Deployment
This article describes how to deploy and maintain an innovaphone container using Docker Compose.
Features
- Clear separation of configuration and deployment
- Centralized configuration using a .env file
- Persistent data storage via mounted volumes
- Easy updates by modifying the container image version
Limitations
- Each container should be placed in its own directory
- Changes to variables or image versions require restarting the container
Requirements
- Docker installed and running
- Docker Compose installed
- Access to the required innovaphone container image
- Sufficient permissions to create directories and store persistent data
Things to know before you begin
- It is recommended to create a dedicated directory for each container
- Each container setup requires at least two files:
- .env
- docker-compose.yml
- The .env file contains all configurable variables
- The docker-compose.yml file defines the container structure and behavior
Configuration
Create container directory
Create a dedicated directory for the container config and container persistant data.
Example:
/dockerdata/apcontainer /dockerdata/apcontainer/data
Set ownership
Set ownership for your user.
Example:
chown -R $USER:$USER /dockerdata/apcontainer
Create .env file
Define all required variables in the .env file.
WEBSERVERPORTHTTP=8080
WEBSERVERPORTHTTPS=8082
LOG_FLAGS=7
LOG_SIZE=1048576
DNSIPV4=8.8.8.8
LIMIT_RAM=512
LIMIT_DISK=10
TZ=Europe/Berlin
HOST_PORT_HTTP=9202
HOST_PORT_HTTPS=9203
DATA_PATH=/dockerdata/apcontainer/data
Description of .env file variables
| Variable | Description |
|---|---|
| WEBSERVERPORTHTTP | Internal HTTP port of the container |
| WEBSERVERPORTHTTPS | Internal HTTPS port of the container |
| LOG_FLAGS | Logging level and options |
| LOG_SIZE | Maximum size of log files |
| DNSIPV4 | DNS server used by the container |
| LIMIT_RAM | RAM limit assigned to the container |
| LIMIT_DISK | Disk space limit assigned to the container |
| TZ | Time zone configuration |
| HOST_PORT_HTTP | External HTTP port on the host |
| HOST_PORT_HTTPS | External HTTPS port on the host |
| DATA_PATH | Host path for persistent container data |
Optional port mappings
The following additional ports can be exposed if required by the application.
| Host Port | Container Port | Protocol | Description |
|---|---|---|---|
| 9002 | 80 | TCP | Standard HTTP (RP) |
| 9004 | 443 | TCP | Standard HTTPS (RP) |
| 1300 | 1300 | TCP | H323/TLS |
| 1500 | 5060 | TCP | SIP |
| 1501 | 5061 | TCP | SIP/TLS |
| 636 | 1636 | TCP | LDAP/TLS |
| 8025 | 8025 | TCP | SMTP |
| 8587 | 8587 | TCP | SMTP/TLS |
| 3478 | 3478 | TCP/UDP | STUN/TURN |
These ports are optional and only required depending on the recommended service.
To enable them, extend the ports section in the following docker-compose.yml file accordingly.
Warning: Each host port can only be used once on a host system. If a port is already in use by another container, the deployment will fail. Always verify port availability before starting the container.
Create docker-compose.yml
Define the container setup in the docker-compose.yml file.
services:
apcontainer:
image: registry.innovaphone.com/cloud/kubernetes/innovaphone-platform-instance:140030
container_name: apcontainer
restart: unless-stopped
ports:
- "${HOST_PORT_HTTP}:${WEBSERVERPORTHTTP}"
- "${HOST_PORT_HTTPS}:${WEBSERVERPORTHTTPS}"
# Optional ports
- "9002:80"
- "9004:443"
- "1300:1300"
- "1500:5060"
- "1501:5061"
- "636:1636"
- "8025:8025"
- "8587:8587"
- "3478:3478/tcp"
- "3478:3478/udp"
volumes:
- ${DATA_PATH}:/mnt/data
environment:
WEBSERVERPORTHTTP: ${WEBSERVERPORTHTTP}
WEBSERVERPORTHTTPS: ${WEBSERVERPORTHTTPS}
LOG_FLAGS: ${LOG_FLAGS}
LOG_SIZE: ${LOG_SIZE}
DNSIPV4: ${DNSIPV4}
LIMIT_RAM: ${LIMIT_RAM}
LIMIT_DISK: ${LIMIT_DISK}
TZ: ${TZ}
ulimits:
nofile:
soft: 500000
hard: 500000
Set permissions
Set permissions for folders and files
Example:
chmod 750 /dockerdata/apcontainer chmod 640 /dockerdata/apcontainer/.env chmod 644 /dockerdata/apcontainer/docker-compose.yml chmod 770 /dockerdata/apcontainer/data
Start container
After creating both files, start the container with:
docker compose up -d
Image Update
To update the container, you can first check the available image tags in the registry:
curl -s https://registry.innovaphone.com/v2/cloud/kubernetes/innovaphone-platform-instance/tags/list
Then modify the image version in the docker-compose.yml file.
Example:
image: registry.innovaphone.com/cloud/kubernetes/innovaphone-platform-instance:140030
Then recreate and start the container:
docker compose up -d
Verification
To verify the deployment, check the following:
- The container is running without errors
- The configured host ports are accessible
- The data directory defined in DATA_PATH is correctly mounted
- Environment variables are applied correctly
Example command:
docker compose ps
Troubleshooting
Container does not start
- Check container logs:
docker compose logs -f
- Verify that all variables in the .env file are correctly defined
- Ensure the image name and version are valid and accessible
- Check for syntax errors in docker-compose.yml
Ports are not accessible
- Verify that the configured host ports are not already in use:
netstat -tulnp | grep <PORT>
- Ensure firewall rules allow access to the defined ports
- Confirm correct port mapping in docker-compose.yml
Volume or data issues
- Check if the host directory defined in DATA_PATH exists
- Verify permissions of the directory:
ls -la /dockerdata/apcontainer/data
- Ensure Docker has access rights to the directory
Configuration changes are not applied
- Restart the container after changes:
docker compose down
docker compose up -d
Container exits unexpectedly
- Inspect logs for errors:
docker compose logs
- Check system resource limits (RAM, disk)
- Verify ulimit settings are supported by the host system
