Running Mephisto with Docker
You may want to keep Mephisto environment entirely contained, and set it up with just a few commands. To do this, we support Docker and Docker Compose as a launch option.
Installation
Install Docker and Docker Compose using the official guide. You can learn about Docker Compose commands on its documentation page.
Running form-based task example
docker-compose -f docker/docker-compose.dev.yml run \
--build \
--publish 3001:3000 \
--rm mephisto_dc \
python /mephisto/examples/form_composer_demo/run_task.py
Customizing Docker settings
All docker settings you can find in docker
directory.
Files and directories:
docker-compose.dev.yml
- minimal development Docker Compose config to start all our examples and appsdocker-compose.dev.vscode.yml
- same as previous, but set up with Python-debugger for VS Code as it requires extra settingsaws_credentials.example
- example of the structure of fileaws_credentials
; this file is mounted into~/.aws/credentials
file inside dockerized environmententrypoints
- directory with entrypoint scripts (used to run commands at launching of a Docker container)server.mturk.sh
- example for MTurkserver.prolific.sh
- example for Prolific
envs
- directory with environmental variales for the dockerized environmentenv.dev
- lists env variables you may need for Mephisto (populate these empty values according to your needs)
If you want to customize Docker configs (e.g. use your AWS credentials), we recommend you to create these files, and save your customizations in them:
server.local.sh
in entrypointsenv.local
inenvs
docker-compose.local.yml
config next to the standarddocker-compose.dev.yml
(and point it toserver.local.sh
andenv.local
files)
Now you can enable your Docker customizations simply by specifying -f docker/docker-compose.local.yml
parameter in all Docker Compose commands. For example:
docker-compose -f docker/docker-compose.local.yml run \
--build \
--publish 3001:3000 \
--rm mephisto_dc \
python /mephisto/examples/form_composer_demo/run_task.py