I have an app with the following services:
web/
- holds and runs a python 3 flask web server on port 5000. Uses sqlite3.worker/
- has anindex.js
file which is a worker for a queue. the web server interacts with this queue using a json API over port9730
. The worker uses redis for storage. The worker also stores data locally in the folderworker/images/
Now I'm trying to make all this work using docker and docker-compose. Being a newbie at those, I'm struggling.
web/Dockerfile
FROM python:3.4-slim
RUN apt-get update
RUN apt-get install -y sqlite3 libsqlite3-dev imagemagick
COPY . /web
WORKDIR /web
RUN pip install -r requirements.txt
worker/Dockerfile
FROM dockerfile/nodejs
COPY . /worker
WORKDIR /worker
RUN npm install
docker-compose.yml
redis:
image: redis:latest
worker:
build: ./worker
ports:
- "9730:9730"
links:
- "redis:redis"
command: npm start
web:
build: ./web
ports:
- "80:5000"
links:
- "worker:worker"
command: python app.py
docker-compose build
works and executes everything just fine.
Now this starts the redis server and the flask server but doesn't start the worker (I know this because I console.log
in my worker/index.js
and docker-compose up
command doesn't print that).
So then I run boot2docker ip
to get the IP address, and when I visit it, I get a Gateway timeout
error but no error on the docker stderr.
I have been trying a bunch of changes to make it work somehow but can't. I really think it would be helpful if someone could explain what's wrong, and how I can make my setup work.