visiblevc / wordpress-starter

A slightly less shitty wordpress development workflow
688 stars 167 forks source link

Can not import my sql file #178

Open JuicyLung91 opened 3 years ago

JuicyLung91 commented 3 years ago

What's your problem about?

I cannot import my SQL dump. Neither during the installation nor manually afterwards.

When I try to import the SQL file manually with: docker-compose exec wordpress /bin/bash "wp db import $(find /data/*.sql | head -n 1) --allow-ro ot" I get the following error:

find: ‘/data/*.sql’: No such file or directory OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"C:/Program Files/Git/usr/bin/bash\": stat C:/Program Files/Git/usr/bin/bash: no such file or directory": unknown

With this command: npm run wp db import /data/database.sql I get the following: `

raumbegruener@0.1.0 wp C:\Users\pr\Desktop\Projekte\raumbegruener docker-compose exec wordpress bash "db" "import" "C:/Program Files/Git/data/database.sql" `;

Server structure

I can see the server structure and verify that the database.sql is found in the data directory:

$ docker exec -it raumbegruener_wordpress_1 bash $ cd .. $ ls Following directories are found one level above /app directory:

app boot dev etc lib media opt root run.sh srv tmp var bin data docker-entrypoint-initwp.d home lib64 mnt proc run sbin sys usr

$ cd data && ls

database.sql

What is your operating system?

Windows

What is your docker version? docker version

Client: Docker Engine - Community Cloud integration 0.1.18 Version: 19.03.13 API version: 1.40 Go version: go1.13.15 Git commit: 4484c46d9d Built: Wed Sep 16 17:00:27 2020 OS/Arch: windows/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.13 API version: 1.40 (minimum version 1.12) Go version: go1.13.15 Git commit: 4484c46d9d Built: Wed Sep 16 17:07:04 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.3.7 GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

docker-compose.yml

version: '3'
services:
    wordpress:
        image: visiblevc/wordpress

        # required for mounting bindfs
        cap_add:
            - SYS_ADMIN
        devices:
            - /dev/fuse
        # required on certain cloud hosts
        security_opt:
            - apparmor:unconfined

        ports:
            - 8080:80
            - 443:443
        volumes:
            - ./data:/data
            - ./scripts:/docker-entrypoint-initwp.d
            - ./wp-content:/app/wp-content
            - ./divi-child-theme:/app/wp-content/themes/divi-child-theme
            - ./rb-products:/app/wp-content/plugins/rb-products
        environment:
            DB_NAME: wordpress
            DB_PASS: root
            WP_LOCALE: de_DE
            WP_DEBUG: 'true'
            WP_DEBUG_DISPLAY: 'true'
            PERMALINKS: /%postname%/
            PLUGINS: >-
                [advanced-custom-fields-pro]https://github.com/wp-premium/advanced-custom-fields-pro/archive/5.6.2.zip,
                wordpress-seo

    db:
        image: mariadb:10 # or mysql:5.7
        volumes:
            - data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: root

    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        ports:
            - 22222:80

volumes:
    data:

Project structure

/data
  /database.sql
/wp-content
/divi-child-theme
/rb-products (my custom plugin)

docker-compose up output

wordpress_1   | ======================================================================
wordpress_1   |                     Begin WordPress Installation
wordpress_1   | ======================================================================
wordpress_1   | ==> Downloading WordPress
wordpress_1   |          Downloading WordPress 5.5.1 (de_DE)...
wordpress_1   |          md5 hash verified: b2fd1d40f1d520c54ee84bc1684c8393
wordpress_1   | Success: WordPress downloaded.
wordpress_1   | ==> Waiting for MySQL to initialize...
wordpress_1   | ==> Configuring WordPress
wordpress_1   | Success: Generated 'wp-config.php' file.
wordpress_1   | ==> Checking database
wordpress_1   | ==> Checking themes
wordpress_1   | ==> Checking plugins
wordpress_1   | ==> Finalizing
wordpress_1   | Success: Rewrite structure set.
wordpress_1   | Success: Rewrite rules flushed.
wordpress_1   | ==> Executing user init scripts
wordpress_1   | Warning: Plugin 'rb-products' is already active.
wordpress_1   | Success: Plugin already activated.
wordpress_1   | ======================================================================
wordpress_1   |                   WordPress Installation Complete!
wordpress_1   | ======================================================================