# [BackstopJS in a Docker Container](https://blog.docksal.io/visual-regression-testing-with-backstopjs-in-a-docker-container-dfd1b9ae8582)
## Setup:
1. Open your bash profile (or equivalent)
```bash
$ edit ~/.bash_profile
```
2. Add the following alias:
```bash
alias backstop='docker run --rm -v $(pwd):/src backstopjs/backstopjs "$@"'
```
3. Restart your terminal or run `source ~/.bash_profile` in all open terminal windows
## Usage:
1. In terminal, navigate to the appropriate testing directory for your project
Run backstop commands as if it were locally installed. eg: `backstop --v`
Note: the first time you run backstop it will download and extract a bunch of packages. After that it launches much more quickly!
2. Create reference images using the command `backstop reference`
3. Run regression tests using the command `backstop test`
Note that the `backstop openReport` part of the script is not currently working. You can easily view the report (at least on a Mac) by typing `open backstop_data/html_report/index.html` in the terminal.