How to run workerman on docker? The following article will introduce to you how to run workerman with docker. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Related recommendations: "workerman Tutorial"
Deploy the gatawayWorker project on docker, and use mysql and redis## in the project
#Install mysqlPull the imagedocker pull mysql:5.7Run 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, 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 is the only name of the container
docker exec -it m_mysql /bin/bash
Option abbreviation | Description | |
---|---|---|
-d | Run the container in the background and print the container ID. | |
-i | Keep standard input open even if there is no connection, usually used with -t. | |
-t | Allocates a pseudo-tty, usually used with -i. |
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 containerapt-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 redisStart workererman
php start.php start -d
For more programming-related knowledge, please visit: Introduction to Programming
The above is the detailed content of How to run workerman on docker?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)