Issue running varnish on docker with Mac m1

  apple-m1, docker, varnish-4, varnish-vcl

Varnish fails to run the VCC compiler of qemu x86_64 on my Mac M1, with this message:

Error:

Running VCC-compiler failed, signal 5

VCL compilation failed

I use Mac Pro M1, Docker 3.3.0 (62632)
Configuration docker-compose:

version: '3.7'

services:

    mysql:
        image: mysql:5.7
        volumes:
              - ./docker/mysql/sql-scripts:/docker-entrypoint-initdb.d/
        ports:
            - 3306:3306
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    fpm:
        build:
            context: ./docker/fpm
        volumes:
            - ${WEB_ROOT}:/var/data/web/httpdocs/localhost
            - ${VOL_GIT}/webroots:/var/data/web/httpdocs/xxxx/
            - ${VOL_GIT_API}/webroots:/var/data/web/httpdocs/xxxx/
            - ${VOL_GIT_CSS}/public:/var/data/web/httpdocs/xxxx/public
            - ${VOL_GIT_CSS}:/var/data/web/httpdocs/xxxx
            - ${VOL_GIT_JS}/dist/v1:/var/data/web/httpdocs/xxxx/public/xxxx/v1
            - ${VOL_GIT_LIVE}/dist/v1:/var/data/web/httpdocs/xxxx/public/xxxx/v1
            - ${WPCONFIG_ROOT}/giroditalia.php:/var/data/web/httpdocs/xxxx/wp-config.php
            - ${WPCONFIG_ROOT}/apigiroditalia.php:/var/data/web/httpdocs/xxxx/private/vars.php
            - ./docker/fpm:/usr/local/etc/php-fpm.d
            - ./docker/fpm/xdebug-conf.ini:/usr/local/etc/php/conf.d/xdebug-conf.ini
        depends_on:
            - mysql
        environment:
            DOCKER_LOG_PATH: ${DOCKER_LOG_PATH}
            WEB_USER: ${WEB_USER}
            WEB_GROUP: ${WEB_GROUP}
            NOBODY_USER: ${NOBODY_USER}
            NOBODY_GROUP: ${NOBODY_GROUP}
            XDEBUG_CONFIG: remote_host=host.docker.internal
    redis:
        image: redis:latest
        command: ["redis-server", "--appendonly", "yes"]
        hostname: redis
        depends_on:
          - fpm

    httpd:
        image: httpd:2.4
        volumes:
            - ${WEB_ROOT}:/var/data/web/httpdocs/localhost
            - ${VOL_GIT}/webroots:/var/data/web/httpdocs/xxxx/
            - ${VOL_GIT_API}/webroots:/var/data/web/httpdocs/xxxx/
            - ${VOL_GIT_CSS}/public:/var/data/web/httpdocs/xxxx/public
            - ${VOL_GIT_CSS}:/var/data/web/httpdocs/xxxx
            - ${VOL_GIT_JS}/dist/v1:/var/data/web/httpdocs/xxxx/public/xxxx
            - ${VOL_GIT_LIVE}/dist/v1:/var/data/web/httpdocs/xxxx
            - ${WPCONFIG_ROOT}/giroditalia.php:/var/data/web/httpdocs/xxxx/wp-config.php
            - ${WPCONFIG_ROOT}/apigiroditalia.php:/var/data/web/httpdocs/xxxx/private/vars.php
            - ./docker/httpd/extra/ssl:/usr/local/apache2/ssl/
            - ./docker/httpd/extra/vhosts:/usr/local/apache2/conf/extra/vhosts/
            - ./docker/httpd/extra/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf
            - ./docker/httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf
        depends_on:
            - fpm
        environment:
            DOCKER_LOG_PATH: ${DOCKER_LOG_PATH}
            
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        depends_on:
            - mysql
        ports:
            - 1234:80
        restart: always
        environment:
            PMA_ARBITRARY: 1
            PMA_HOST: mysql
            PMA_PORT: ${MYSQL_PORT}
            PMA_USER: ${MYSQL_USER}
            PMA_PASSWORD: ${MYSQL_PASSWORD}

    varnish:
        depends_on:
          - httpd
        image: lgervasi/varnish4
        volumes:
          - "./docker/varnish/conf:/etc/varnish"
        ports:
          - "80:80"

    hitch:
        depends_on:
          - varnish
        image: lgervasi/hitch
        volumes:
          - "./docker/hitch:/etc/hitch"
        ports:
          - "443:443"

The other images start normally. Except varnish which starts for a few seconds and then stops with the error message I posted above.

Source: Docker Questions

LEAVE A COMMENT