Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kev0's avatar
Level 1

Laravel Sail Can't create mariadb or mysql Images?

Heyy!

This is fairly abrupt, and sorry for that, but I've been beating my head against the wall on this.

I've been trying to start a new Laravel application for work using Sail. However, one of the dependencies I'll need is mariadb, but when I run the sail up command, it says "Container project-mariadb-1 Creating" and then spits out "Error response from daemon: not a directory". The things I have read and tried are below:

  1. According to this Stack Overflow post: [StackOverflow hostname+domain omitted due to forum rules]/a/45104143 the user fixed the issue by restarting their docker. Which I thought, running sail down and sail up should do. I also tried running docker commands manually with no success.

  2. I have also tried destroying all associated docker images with my project in case there was a bad cache somewhere. I also deleted the docker-compose.yml file and tried to use Sail to regenerate it based on dependencies. That didn't work either.

  3. I also destroyed the entire project directory and started a fresh Laravel install using both methods: composer commands to generate the project, then install Sail within the project directory. I also used the curl command to generate the Laravel project with Sail directly. The fresh installs state they pull the mariadb images, but running sail up can't seem to generate the containers.

  4. I ran the sail build --no-cache command, which also did not work.

  5. I double-checked the docker-compose.yml file and messed around with the image name that Sail pulls to see if that made a difference. It did not. ;-;

  6. I double-checked the volume directories and those all exist also.

  7. My senior also has no idea after looking into it. He suggested options 3, 4, and 6, which I repeated in front of him with no success. He suspects there's a problem with my PHP and/or wsl instances, which we double-checked versioning and dependencies and they all seem correct to us.

I am a junior dev, there may be something glaringly obvious about docker that I just don't understand yet also. I apologize for my inexperience.

0 likes
4 replies
Marven's avatar

Could you share your docker-compose.yml? Mine (using mysql) looks like this:

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.1
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.1/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
            - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - db
            - selenium

    db:
        image: 'mysql:8.0'
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
        volumes:
            - .docker/db/init:/docker-entrypoint-initdb.d
            - 'sailmysql:/var/lib/mysql'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
            retries: 3
            timeout: 5s
    
    phpmyadmin:
        image: phpmyadmin/phpmyadmin:latest
        restart: unless-stopped
        environment:
            PMA_HOST: db
            MYSQL_USER: ${DB_USERNAME}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            UPLOAD_LIMIT: 1000M
        ports:
            - "9090:80"
        depends_on:
            - db
        networks:
            - sail

    selenium:
        image: 'selenium/standalone-chrome'
        volumes:
            - '/dev/shm:/dev/shm'
        networks:
            - sail

    mailhog:
        image: 'mailhog/mailhog:latest'
        ports:
            - '${FORWARD_MAILHOG_PORT:-1025}:1025'
            - '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
        networks:
            - sail

networks:
    sail:
        driver: bridge
        
volumes:
    mysqldata:
    sailmysql:
        driver: local

kev0's avatar
Level 1

@Marven Thanks for helping me look into this! It should be relatively default from a fresh install, but here is my docker-compose.yml file:

version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.1
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.1/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
            - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - mariadb
            - redis
            - meilisearch
    mariadb:
        image: 'mariadb:10'
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ROOT_HOST: "%"
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
        volumes:
            - 'sail-mariadb:/var/lib/mysql'
            - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
            retries: 3
            timeout: 5s
    redis:
        image: 'redis:alpine'
        ports:
            - '${FORWARD_REDIS_PORT:-6379}:6379'
        volumes:
            - 'sail-redis:/data'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "redis-cli", "ping"]
            retries: 3
            timeout: 5s
    meilisearch:
        image: 'getmeili/meilisearch:latest'
        ports:
            - '${FORWARD_MEILISEARCH_PORT:-7700}:7700'
        volumes:
            - 'sail-meilisearch:/meili_data'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "wget", "--no-verbose", "--spider",  "http://localhost:7700/health"]
            retries: 3
            timeout: 5s
networks:
    sail:
        driver: bridge
volumes:
    sail-mariadb:
        driver: local
    sail-redis:
        driver: local
    sail-meilisearch:
        driver: local
Marven's avatar

@kev0 I am sorry to see, that there does not seem to be an issue with the docker-compose.yml. Maybe for the others it would be helpful if you could show the whole output of sail up, so that maybe it shows any messages hinting to what seems to be the problem. Also: What OS do you use?

1 like
kev0's avatar
Level 1

@Marven I am on W10, with WSL2, which is running Ubuntu 20.04. Thank you so much for trying! I do appreciate it.

For anyone willing to help with this, the screen shot that Marven suggested is below (https link; expires in 3 days):

[https protocol]ibb.co/Lx5ZVLn

Please or to participate in this conversation.