Migrate from a VM to Docker

In this guide we'll use [dradispro.old] to refer to the IP address of your existing Dradis VM and [host] to refer to the hostname of your new Docker host.

Step 0: Prepare your host

First of all, you will need to prepare your new host for deployment. On the host where you are going to deploy your Docker instance, before deploying it, create a directory called init.

Step 1: Migrate the database

  1. Export your database from the existing VM:

    $ ssh dradispro@[dradispro.old] -- 'dp-export-mysql' > dradis-mysql-backup.sql
  2. Open dradis-mysql-backup.sql in a text editor, add the following two lines at the very top of the file, and save:

    CREATE DATABASE IF NOT EXISTS dradis_production;
    USE dradis_production;
  3. Copy the file into the init/ directory on your new Docker host:

    $ scp dradis-mysql-backup.sql deployer@[host]:init/

Your data will be imported automatically into the database container on first startup.

Step 2: Deploy the Docker containers

This step is the same as deploying a fresh, blank Dradis Docker instance. The only difference is that with your .sql file in the init folder, your instance will be created with the data migrated from your VM instance.

curl -fsSL https://get.dradis.com | /bin/bash

Step 3: Update configurations

You'll need to migrate your configuration values from the VM to the new container environment.

  1. Copy the migration script into the app container:

    $ docker cp migrate_configuration.rb app:/dradispro
  2. Run the migration script:

    $ docker exec -i app bundle exec rails runner migrate_configuration.rb

Step 4: Migrate templates, attachments, and more

  1. Copy the dp-import script into the app container:

    $ docker cp pro/dp-import app:/dradispro
  2. Run each of the following import commands in turn:

    $ ssh dradispro@[dradispro.old] 'dp-export-storage' |\
        docker exec -i app /dradispro/dp-import "storage"
    $ ssh dradispro@[dradispro.old] 'dp-export-templates' |\
        docker exec -i app /dradispro/dp-import "templates"
    $ ssh dradispro@[dradispro.old] 'dp-export-attachments' |\
        docker exec -i app /dradispro/dp-import "attachments"

    If you had Gateway installed on your VM, also run:

    $ ssh dradispro@[dradispro.old] 'dp-export-themes' |\
        docker exec -i app /dradispro/dp-import "themes"

    If any users on your instance has custom avatars, also run:

    ssh dradispro@[dradispro.old] 'tar -cf - -C /opt/dradispro/dradispro/shared avatars' |\
        docker exec -i app tar -xpf - -C /dradispro/storage/public

Seven Strategies To Differentiate Your Cybersecurity Consultancy

You don’t need to reinvent the wheel to stand out from other cybersecurity consultancies. Often, it's about doing the simple things better, and clearly communicating what sets you apart.

  • Tell your story better
  • Improve your testimonials and case studies
  • Build strategic partnerships

Loading form...

Your email is kept private. We don't do the spam thing.