search
HomePHP FrameworkWorkermanLet's talk about how to deploy and run workererman on docker

How to run workerman on docker? The following article will introduce to you how to deploy and run workererman on docker. I hope it will be helpful to you.

Let's talk about how to deploy and run workererman on docker

Deploy the gatawayWorker project on docker. Mysql and redis are used in the project.

Related recommendations: "workerman Tutorial"

Install mysql

Pull the image

docker pull mysql:5.7

Run the container

docker run  -d  -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root --name m_mysql mysql:5.7

-d Run in the background
-p Port mapping, the front is the host port, and the back is the container port that needs to be mapped
-e Set the environment variable, MYSQL_ROOT_PASSWORD is the initial password of the mysql root user
-- name The unique name of the container

Enter the container

docker exec -it m_mysql /bin/bash
##OptionOption abbreviationDescription–detach-dRun the container in the background and print the container id. –interactive-iKeep standard input open even if there is no connection, usually used with -t. –tty-tAllocates a pseudo-tty, usually used with -i.
mysql remote connection settings

mysql -uroot -proot
use mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES;

This way you can connect through the public network

Install php

Pull Mirror

docker pull php:7.3-cli

Run

docker run --name myphp -p 8282:8282 -v /home/wwwroot:/www -d php:7.3-fpm

-p Add host to container port mapping to map the 8282 that needs to be used. Multiple ports can be used multiple times -p

-v Add directory Mapping Put the project under /home/wwwroot, and the environment required to install workererman will automatically appear in the container

apt-get install libevent-dev
apt-get install libevent-dev
docker-php-ext-install pcntl sockets
docker-php-ext-install event
docker-php-ext-install pdo_mysql
docker-php-ext-install redis

Start workererman

php start.php start -d

For more programming-related knowledge, please visit:

Programming Video

! !

The above is the detailed content of Let's talk about how to deploy and run workererman on docker. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool