<p>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.</p>

<p><a href="https://i.sstatic.net/7JVaf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7JVaf.png" alt="enter image description here"></a></p>

CC BY-SA 4.0
2018-12-08T03:37:45.190Z
2018-12-08T03:37:45.190Z
bshelling
<p>Partial solution - I removed all backups except the most recent from the backups folder.</p>

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

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

CC BY-SA 4.0
2018-12-06T11:03:08.800Z
2018-12-06T11:03:08.800Z
Paddy Dewhurst
<p>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.</p>

<p>Here are the steps I took</p>

<ol>
<li>I used these default.conf and docker-compose.yml files <a href="https://github.com/CraftQuest/craftcms" rel="nofollow noreferrer">here</a>  to create a local environment with Docker.</li>
<li>I made a site locally, and backed up the database several times (and so now have a series of backups - see image below)</li>
<li>I restarted Docker after updating to the latest version, then ran <code>docker-compose up</code> to relaunch.</li>
<li>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.)</li>
</ol>

<p>Here is how my backup folder looks:
<a href="https://i.sstatic.net/Dhrpb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Dhrpb.png" alt="enter image description here"></a></p>

<p>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!</p>

<pre><code># 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: &gt;- # 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:
</code></pre>

<craft3><database><import><back-up>
Import database backup when using docker
# Import database backup when using docker

(Asked by: username_0 on 2018-12-05)

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

I used these default.conf and docker-compose.yml files here  to create a local environment with Docker.
I made a site locally, and backed up the database several times (and so now have a series of backups - see image below)
I restarted Docker after updating to the latest version, then ran docker-compose up to relaunch.
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:

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:

**Tags:** craft3, database, import, back-up


---

## 2 answers

### Answer by username_1 on 2018-12-08. Score: 1 | Accepted answer

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](https://i.sstatic.net/7JVaf.png)](https://i.sstatic.net/7JVaf.png)


---

### Answer by username_0 on 2018-12-06. Score: 1

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.


---

