More Docker Tricks
Mounting External Folder
If you are new to Docker and trying MagicMirror with the Docker container, you might be wondering how you can send and retrieve files from a Docker container, so that you can use the MagicMirror Docker container on your own contracts, and save the outputs in locations you want.
For that, we use the -v
mounting volume option when we start the MagicMirror Docker container. Assume you have a folder ./myfolder/
on your own system with the following layout.
Let's say you want the container to be able to read the contract files in ./myfolder/contracts/
and outputs the result in ./myfolder/result/
. You can execute the following command to launch the container with ./myfolder/
mounted to /home/mount/
in the container.
*Note, /home/
is where the magic_mirror
executable is at.
Once you execute the above command, you will find that the /home/mount/
directory is created in the Docker container, and both your system and container can read and write into the directory.
Next, you can execute the following command in the container to fuzz a.sol
with the --output_dir
option in magic_mirror, so the outputs from MagicMirror will be saved in the result folder of your own.
You will then see the outputs showing up on your own system in the ./myfolder/result/a.sol/
directory.
One Command That Does It All
In the above instructions, you still need two commands to do what you want, however, there's a better way, a single command that does it all:
Launch the container
Mount the folder
Fuzz your contract(s), output results in your mounted folder
Terminate and delete the container instance
Copy, paste, update the following command and you are on your way to a simpler life.
And here is an explanation of how this command is constructed.
Last updated