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

Time:04-30

I have a strange docker behavior that I don't know where it comes from. After I run docker compose build my terminal just kind of "Freezes" after everything is build and it seems like it's still waiting for something.

After I press CTRL C

I run docker compose up where everything runs as expected but when i try to call

http://kubernetes.docker.internal/

in my browser I get a 503

What am i Missing ? How Do I even debug this ?

EDIT: Output before 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

after this it just freezes

Here is my compose file:

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

As request, here is my vhost conf

    <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}::$1 ^(/. )/(.*)::\2$
                RewriteRule ^(.*) - [E=BASE:%1]

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

                RewriteCond %{ENV:REDIRECT_STATUS} ^$
                RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [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>

CodePudding user response:

I updated docker and my apache works now

  • Related