Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save foxsake/dd27f79e5ce46560d6aaf790577609ce to your computer and use it in GitHub Desktop.

Select an option

Save foxsake/dd27f79e5ce46560d6aaf790577609ce to your computer and use it in GitHub Desktop.

Revisions

  1. @chalmagean chalmagean revised this gist Aug 11, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Backup docker named volume
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@
    # 2. Then, we create a new folder inside the `ubuntu` container named `/backup`.
    # 3. We then create an archive containing the contents of the `/dbdata` folder and we store it inside the `/backup` folder (inside the container).
    # 4. We also mount the `/backup` folder from the container to the docker host (your local machine) in a folder named `/backups` inside the current directory.
    docker run --rm -v myproj_dbdata:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db.tar /dbdata
    docker run --rm -v myproj_dbdata:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db_data_"$(date '+%y-%m-%d')".tar /dbdata
  2. @chalmagean chalmagean revised this gist Aug 11, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Backup docker named volume
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Here's how to back up a named volume

    # 1. Using a `ubuntu` image, we mount the named volume (<projectname_volumename>) to a `/dbdata` folder inside the `ubuntu` container.
    # 1. Using a `ubuntu` image, we mount the named volume (`myproj_dbdata`) to a `/dbdata` folder inside the `ubuntu` container.
    # 2. Then, we create a new folder inside the `ubuntu` container named `/backup`.
    # 3. We then create an archive containing the contents of the `/dbdata` folder and we store it inside the `/backup` folder (inside the container).
    # 4. We also mount the `/backup` folder from the container to the docker host (your local machine) in a folder named `/backups` inside the current directory.
    docker run --rm -v dealerfx_db_data:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db.tar /dbdata
    docker run --rm -v myproj_dbdata:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db.tar /dbdata
  3. @chalmagean chalmagean created this gist Aug 11, 2016.
    7 changes: 7 additions & 0 deletions Backup docker named volume
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # Here's how to back up a named volume

    # 1. Using a `ubuntu` image, we mount the named volume (<projectname_volumename>) to a `/dbdata` folder inside the `ubuntu` container.
    # 2. Then, we create a new folder inside the `ubuntu` container named `/backup`.
    # 3. We then create an archive containing the contents of the `/dbdata` folder and we store it inside the `/backup` folder (inside the container).
    # 4. We also mount the `/backup` folder from the container to the docker host (your local machine) in a folder named `/backups` inside the current directory.
    docker run --rm -v dealerfx_db_data:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db.tar /dbdata