#拉取镜像
docker pull hyperf/hyperf:7.4-alpine-v3.15-dev

1.设置源
 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer

2. 创建项目
  mkdir /data/project1
  cd /data/project1
  composer create-project hyperf/hyperf-skeleton #hyper驱动
  composer create-project hyperf/swow-skeleton   #swow驱动

3. 启动项目
  cd /data/project1/hyperf-skeleton
  php bin/hyperf.php start



4.运行现有的项目
cd /data/bk-bjdzkjapi
composer update -o #安装插件
php bin/hyperf.php start #启动

php --ri swoole #查看已安装的swoole的版本
php -r "phpinfo();" |grep swoole  #查看phpinfo信息
  • docker-compose.yml
version: "3.9"
services:
  hyperf:  
    image: hyperf/hyperf:7.4-alpine-v3.14-swoole
    restart: always 
    container_name: hyperf_1024
    #build:
    #  context: ./
    #  dockerfile: dockerfile
    volumes:
      - './logs:/var/log/nginx'
      - './data:/data'
    ports:
      - "9502:9502"
      - "9501:9501"
    tty: true
    #privileged: true
#    environment:
#      - NGINX_PORT=80
    networks:
      - my_net  
networks:
  my_net:
    driver: bridge
  • 错误处理
错误:[Warning] World-writable config file '/etc/mysql/my.cnf' is ignored.
chmod 644 /etc/mysql/my.cnf
chmod 644 /etc/mysql/conf.d/*.cnf