I am trying to import a database backup into a craft instance running on Docker, but none of the fields or content from the latest backup are importing.

Here are the steps I took

  1. I used these default.conf and docker-compose.yml files here to create a local environment with Docker.
  2. I made a site locally, and backed up the database several times (and so now have a series of backups - see image below)
  3. I restarted Docker after updating to the latest version, then ran docker-compose up to relaunch.
  4. Craft loaded with the initial DB, but none of the fields or content from the latest backup appear (localhost actually returns a Twig runtime err when it encounters the first field.)

Here is how my backup folder looks: enter image description here

It seems the issue lies with my docker-compose.yml (below), but I don't see how to edit this to call the right DB backup. Any help or advice much appreciated!

# docker-compose.yml
version: '2.1'

services:
  nginx:
    image: nginx:alpine
    ports:
      - 80:80
    depends_on:
      - craft
    volumes_from:
      - craft
    volumes:
      - ./default.conf:/etc/nginx/conf.d/default.conf # nginx configuration (see below)
      - ./assets:/var/www/html/web/assets # For static assets (media, js and css). We don't need PHP for them.

  craft:
    image: urbantrout/craftcms:mysql
    depends_on:
      - mariadb
    volumes:
      - ./backups:/var/www/html/storage/backups
      - ./templates:/var/www/html/templates # Craft CMS template files
      - ./modules:/var/www/html/modules # Craft modules directory
      - ./config/element-api.php:/var/www/html/config/element-api.php # Element API file - we require the plugin below
    environment:
      DEPENDENCIES: >- # additional composer packages (must be comma separated)
        yiisoft/yii2-redis,
        craftcms/redactor,
        craftcms/element-api,
        nystudio107/craft-seomatic

      CRAFTCMS_EMAIL: XXXXXXXXXXXXX
      CRAFTCMS_USERNAME: admin
      CRAFTCMS_PASSWORD: XXXXXXXXXXXXXX
      CRAFTCMS_SITENAME: Craft CMS Installation
      CRAFTCMS_LANGUAGE: en-US

      REDIS_HOST: redis
      SESSION_DRIVER: redis
      CACHE_DRIVER: redis

      DB_SERVER: mariadb
      DB_NAME: craft
      DB_USER: craft
      DB_PASSWORD: secret
      DB_DATABASE: craft
      DB_SCHEMA: public
      DB_DRIVER: mysql
      DB_PORT: 3306

  mariadb:
    image: mariadb:10.1
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: craft
      MYSQL_PASSWORD: secret
      MYSQL_DATABASE: craft
    volumes:
      # Persistent data
      - dbdata:/var/lib/mysql

  redis:
    image: redis:4-alpine
    volumes:
      - redisdata:/data

volumes:
  dbdata:
  redisdata:
New contributor
Paddy Dewhurst is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
up vote 1 down vote accepted

You can expose a port on your mariadb service then upload your backup using Sequel Pro or Workbench. Don't forget to add the restart:always to the service.

enter image description here

Partial solution - I removed all backups except the most recent from the backups folder.

It seems that changing the site name prevented the site from finding the correct sql file or adding new backups to .ignore.

If you want to change the name then be sure to remove other backups from the site directory.

New contributor
Paddy Dewhurst is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Paddy Dewhurst is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.