我是 docker 新手,并且坚持正确地为 psiturk 暴露端口。
我有一个 docker-compose.yml 文件,它创建了一个 psiturk 容器、一个 nginx 容器、一个管理员容器和一个 mysql 容器。我正在尝试在 mTurk 上以沙盒模式运行 psiturk 实验。服务器无法连接。我已经暴露了端口。当我在 Docker 之外运行 psiturk 时,我可以在沙盒中运行实验,因此它不是我计算机的防火墙。
我听说过发布暴露的端口并尝试通过添加:
ports:
- 22362:22362
到 psiturk 容器,但它没有用。
对于我的 docker-compose.yml 文件:
version: '3'
services:
psiturk:
container_name: my-experiment
build: .
volumes:
- ./exp:/exp
tty: true
stdin_open: true
restart: unless-stopped
nginx:
container_name: my-experiment-nginx
image: nginx:latest
ports:
- 80:80
volumes:
- ./exp:/var/www/exp:ro
- ./default.conf:/etc/nginx/conf.d/default.conf
restart: unless-stopped
db:
container_name: my-experiment-db
image: mysql:5.7
volumes:
- ./data/db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: anothersafepassword
MYSQL_DATABASE: shared4data
MYSQL_USER: jorja
MYSQL_PASSWORD: totallysafepassword
restart: unless-stopped
adminer:
container_name: my-experiment-adminer
image: adminer:latest
ports:
- 127.0.0.1:8080:8080
对于我的 dockerfile:
FROM python:3.6-stretch
LABEL maintainer="Jorja Shires <jshires@nevada.unr.edu>" version="1.0"
ENV PSITURK_GLOBAL_CONFIG_LOCATION "/exp"
WORKDIR "/exp"
RUN pip install \
psiturk==2.3.8 \
pymysql==0.10.0 \
python-Levenshtein==0.12.0 \
&& rm -rf ~/.cache/pip
CMD ["bash"]
EXPOSE 22362
EXPOSE 80
对于我的 psiturk 配置文件:
[Server Parameters]
host = 0.0.0
port = 22362
cutoff_time = 30
logfile = server.log
loglevel = 2
debug = true
threads = auto
adserver_revproxy_host = MyStaticIPAddress
adserver_revproxy_port = 80
[Shell Parameters]
launch_in_sandbox_mode = true
#bonus_message = "Thanks for participating!"
use_psiturk_ad_server = true
ad_location = false