Importing the sample data into a Docker volume
Create a new Docker volume, then import sample data into the volume.
About this task
Procedure
-
Create the Docker volume for the sample data directory:
docker volume create <volume name>
For example, to create a volume named sample-data:docker volume create sample-data
-
Use a temporary Docker container to import the sample data:
docker run --rm -i --user="0:0" -v <volume name>:/local/notesdata \ --entrypoint "/bin/bash" <image> \ -c "cd /local/notesdata; tar xjf - <&0; chown -R 1000:root /local/notesdata" < <tar archive file>
Where:<volume name>
is the name of the volume you just created.<image>
identifies the volt-docker image you loaded in Loading the volt-docker tar archive file to Docker<tar archive file>
is the file containing a sample data directory.
This command starts a volt-docker container in bash mode and sequentially executes three shell commands:cd /local/notesdata
changes to the /local/notesdata directory.tar xjf - <&0
extracts the tar archive file from stdin.chown -R 1000:root /local/notesdata
changes the ownership of all files in /local/notesdata.
For example, the following command imports sample data from renovations-data.tbz2 into a volume named sample-data:docker run --rm -i --user="0:0" -v sample-data:/local/notesdata \ --entrypoint "/bin/bash" volt-docker:V1101-1.0.0.11 \ -c "cd /local/notesdata; tar xjf - <&0; chown -R 1000:root /local/notesdata" < renovations-data.tbz2
- The sample data is imported into the volume. Then the temporary Docker container stops and is automatically removed.