为什么我的 docker 构建从未停止? (503服务不可用)

Why does my docker build never stop ? (503 Service Unavailable)

我有一种奇怪的 docker 行为,我不知道它从何而来。 在我 运行 docker compose build 之后,我的终端只是在构建完所有内容后“冻结”,似乎它还在等待什么。

在我按下 CTRL+C 之后

我 运行 docker compose up 一切都如预期的那样 运行 但是当我尝试调用

http://kubernetes.docker.internal/

在我的浏览器中我得到一个 503

我错过了什么?我该如何调试它?

编辑:CTRL + c 之前的输出

.....

     => CACHED [7/7] RUN rm -f /run/apache2/apache2.pid                                                                                                                                      0.0s
 => exporting to image                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                  0.0s
 => => writing image sha256:2dc74183b8737ac160d2f463da4ea0fbaafd96dbd2b7509933a74a5d068886ce                                                                                             0.0s
 => => naming to docker.io/library/web-app_apache                                                                                                                           0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Recreating mysql_app               ... done
Recreating node_app                ... done
Recreating web-app-mailhog-1 ... done
Recreating php_app                 ... done
Recreating apache_app              ... done

在此之后它就冻结了

这是我的撰写文件:

version: '3'
services:
  mysql:
    image: mysql:5.7
    platform: linux/x86_64
    container_name: mysql_app
    ports:
      - "3307:3306"
    volumes:
      - ./docker/data/db:/usr/local/mysql/
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: app

  apache:
    build: docker/apache
    container_name: apache_app
    ports:
      - 80:80
    volumes:
      - ./docker/config/vhosts:/etc/apache2/sites-enabled
      - ./htdocs:/home/wwwroot/htdocs:cached
    depends_on:
      - php

  php:
    build: docker/php
    container_name: php_app
    volumes:
      - ./htdocs:/home/wwwroot/htdocs:cached
    environment:
      - APPLICATION_ENV=docker

  node:
    image: node:lts
    container_name: node_app
    tty: true
    working_dir: /home/wwwroot/htdocs/frontend
    volumes:
      - ./htdocs/frontend:/home/wwwroot/htdocs/frontend:cached
      - ./htdocs/public:/home/wwwroot/htdocs/public:cached
      - /var/www/node_modules

  mailhog:
    image: mailhog/mailhog
    ports:
      - 1025:1025 # smtp server
      - 8025:8025 # web ui

根据要求,这是我的虚拟主机配置文件

    <VirtualHost *:80>

        Define server_name mywebsitename.l
        Define basedocroot  /home/wwwroot/htdocs
        Define docrootweb   ${basedocroot}/public
        Define logdir   /var/log/apache2/

        SetEnv APPLICATION_ENV docker

        <FilesMatch .php$>
         SetHandler "proxy:fcgi://php_mywebsitename:9000"
        </FilesMatch>

        ServerName ${server_name}
        DocumentRoot ${docrootweb}
        ErrorLog ${logdir}/error.log
        CustomLog ${logdir}/access.log Combined

        RewriteEngine On
        RewriteCond %{HTTP:Authorization} ^(.*)
        RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

        <Directory ${docrootweb}>
            AllowOverride All
            Require all granted
        </Directory>

        <Directory ${basedocroot}/var>
            <IfModule mod_authz_core.c>
                Require all denied
            </IfModule>
            <IfModule !mod_authz_core.c>
                Order deny,allow
                Deny from all
            </IfModule>
        </Directory>

        <Directory ${docrootweb}>
            DirectoryIndex ${docrootweb}/index.php
            <IfModule mod_negotiation.c>
                Options -MultiViews
            </IfModule>

            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteCond %{REQUEST_URI}:: ^(/.+)/(.*)::$
                RewriteRule ^(.*) - [E=BASE:%1]

                RewriteCond %{HTTP:Authorization} .
                RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

                RewriteCond %{ENV:REDIRECT_STATUS} ^$
                RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/ [R=301,L]

                RewriteCond %{REQUEST_FILENAME} -f
                RewriteRule ^ - [L]

                RewriteRule ^ %{ENV:BASE}/index.php [L]
            </IfModule>

            <IfModule !mod_rewrite.c>
                <IfModule mod_alias.c>
                    RedirectMatch 302 ^/$ /index.php/
                </IfModule>
            </IfModule>
        </Directory>

        Undefine server_name
        Undefine basedocroot
        Undefine docrootweb
        Undefine logdir
</VirtualHost>

我更新了 docker,我的 Apache 现在可以用了