> For the complete documentation index, see [llms.txt](https://magic-mirror.gitbook.io/magicmi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://magic-mirror.gitbook.io/magicmi/running-magicmirror/more-docker-tricks.md).

# More Docker Tricks

## Mounting External Folder <a href="#mounting-external-folder" id="mounting-external-folder"></a>

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.

```
.└── myfolder/
     ├── result/
     └── contracts/
         ├── a.sol        
         └── b.sol
```

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.

```
docker run -it -w /home -v ./myfolder:/home/mount magicmirrorfuzzing/magic_mirror
```

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.

```
./magic_mirror single-file-mode --contract_dir ./mount/contracts/a.sol --output_dir ./mount/result
```

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 <a href="#one-command-that-does-it-all" id="one-command-that-does-it-all"></a>

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:

1. Launch the container
2. Mount the folder
3. Fuzz your contract(s), output results in your mounted folder
4. Terminate and delete the container instance

Copy, paste, update the following command and you are on your way to a simpler life.

```
docker run --rm -it -w /home -v ./myfolder:/home/mount magicmirrorfuzzing/magic_mirror ./magic_mirror single-file-mode --contract_dir ./mount/contracts/a.sol --output_dir ./mount/result 
```

And here is an explanation of how this command is constructed.

![](https://968700823-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MYz9LoWYcE5KpUYmxqj%2F-MZPKBLzQyI4oKqavgUg%2F-MZPKLVBzPY6aSu_T-i_%2FWeChat%20Screenshot_20210428160858.png?alt=media\&token=021c3ece-fe37-4659-9214-e42734e8f447)
