How to Deploy Webman PHP Framework with Docker in One Click

Learn step‑by‑step how to set up Docker and Docker Compose on Linux, macOS, and Windows, install optional Composer, initialize a Webman project, and use the built‑in docker‑compose.yml to perform one‑click development or production deployments, including custom service configuration and troubleshooting tips.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Deploy Webman PHP Framework with Docker in One Click

Overview

Webman is a high‑performance, extensible PHP framework built on Workerman, supporting HTTP, WebSocket, TCP, UDP and other protocols. Since version 2.0 it includes Docker support for one‑click deployment.

Environment preparation

Docker and Docker Compose

Linux (CentOS/Ubuntu)

Update packages:

sudo yum update -y   # CentOS
sudo apt update && sudo apt upgrade -y   # Ubuntu

Install Docker:

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y   # CentOS
sudo apt install docker.io -y   # Ubuntu

Start and enable Docker service:

sudo systemctl start docker
sudo systemctl enable docker

Verify installation:

sudo docker --version
docker compose version

Add your user to the docker group to avoid sudo for each command and restart the terminal.

macOS

Download and install Docker Desktop from https://www.docker.com/products/docker-desktop.

Verify with docker --version.

Windows

Download and install Docker Desktop from https://www.docker.com/products/docker-desktop and enable WSL 2 if required.

Verify with docker --version in PowerShell.

Ensure Docker Compose v2+ is available (use the docker compose command).

Composer (optional)

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version

Project initialization

Create a new Webman project:

composer create-project workerman/webman webman-docker-demo
cd webman-docker-demo

This generates the standard structure, including a pre‑configured docker-compose.yml file.

Check environment compatibility: php start.php check Make sure required extensions such as pcntl and posix are enabled.

One‑click deployment

Debug (development) mode

docker compose up

Pulls the Webman image (PHP 8.1+).

Shows container logs for debugging.

Open http://localhost:8787 to see the welcome page.

Production mode

docker compose up -d

Runs services detached.

View logs with docker compose logs -f.

Stop services with docker compose down.

Custom configuration

Edit docker-compose.yml to add additional services, e.g., MySQL:

services:
  webman:
    image: workerman/webman:latest
    ports:
      - "8787:8787"
    volumes:
      - .:/app
  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3306:3306"

After editing, re‑run docker compose up -d to apply changes.

Accessing the application

Open a browser and navigate to http://<server-IP>:8787 (or http://localhost:8787 for local setups) to view the default Webman homepage.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendDockerPHPDocker ComposeWebmanOne‑Click Deployment
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.