Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker github操作-无法连接到mysql_Docker_Github_Mariadb_Github Actions - Fatal编程技术网

Docker github操作-无法连接到mysql

Docker github操作-无法连接到mysql,docker,github,mariadb,github-actions,Docker,Github,Mariadb,Github Actions,因此,我正在尝试使用github操作设置laravel ci服务器。而且,我使用edbizarro/gitlab ci pipeline php:7.3作为容器,并使用官方的mariadb docker as mysql服务: services: mysql: image: mariadb:10.3 env: MYSQL_USER: root MYSQL_PASSWORD: root MYSQ

因此,我正在尝试使用github操作设置laravel ci服务器。而且,我使用
edbizarro/gitlab ci pipeline php:7.3
作为容器,并使用官方的mariadb docker as mysql服务:

services:
      mysql:
        image: mariadb:10.3
        env:
          MYSQL_USER: root
          MYSQL_PASSWORD: root
          MYSQL_ROOT_PASSWORD: root
        ports:
          - 13306:3306 
...
我正在尝试运行,运行mysql命令来导入数据库:

  - name: Setting Up DB
        run: |
          mysql -Tv -h mysql -P 13306 --protocol=tcp -u root -proot < ./storage/test.sql
不知道我还能在这里做什么

这是我也尝试过的,都告诉我,选项不存在

 services:
      mysql:
        image: mariadb:10.3
        options: --bind_address=""
        env:
          MYSQL_USER: root
          MYSQL_PASSWORD: root
          MYSQL_ROOT_PASSWORD: root
        ports:
          - 13306:3306 
我尝试了以下几种选择:

  • ——禁用绑定地址
  • --bind address=”“
  • 以下是我从github获得的一些日志消息:(-Tv没有提供任何有用的信息)

    或许可以这样尝试:

     mysql: 
        image: mariadb:10.3 
        env:    
            MYSQL_ROOT_PASSWORD: root   
        ports:  
        - 3306:3306 
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    

    在从何处运行导入脚本的connexion之前,会进行健康检查以确保服务正常运行?它在同一个docker compose中吗?它是github操作,所以在docker内部运行的github操作或同一个docker compose文件中?docker,我不认为它们使用docker compose`mysql-Tv-hMySQL-p1306`这里
    -hMySQL
    主机只有在同一个docker compose中启动时才能在容器中访问
    docker.io/library/mariadb:10.3
    /usr/bin/docker create --name 607ae471e5844570b9e2fcf4f57ed78a_mariadb103_d94369 --label 2b5be7 --workdir /__w/laravel/laravel --network github_network_ab8a7ba8c1624f95bdc2784147b4b5e1 --network-alias mysql -p 13306:3306 -e "MYSQL_USER=root" -e "MYSQL_PASSWORD=root" -e "MYSQL_ROOT_PASSWORD=root" -e "HOME=/github/home" -v "/home/runner/work":"/__w" -v "/home/runner/runners/2.157.3/externals":"/__e":ro -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" mariadb:10.3
     c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3
    /usr/bin/docker start c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3
    c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3
    /usr/bin/docker ps --all --filter id=c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3 --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
    c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3 Up Less than a second
    /usr/bin/docker port c3b10a5c4799a671f55c2f2b7a33803abd9228830be5e8821b51f10a2b2951b3
    3306/tcp -> 0.0.0.0:13306
    
     mysql: 
        image: mariadb:10.3 
        env:    
            MYSQL_ROOT_PASSWORD: root   
        ports:  
        - 3306:3306 
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3