How should I run thumbd as a service inside a Docker container?
I’d like to run
thumbd as a service inside a node Docker image! At the moment I’m just running it before I start my app, which is no use to me! Is there a way I could setup my Dockerfile to run it as an init.d service on startup without blocking any of my other docker commands?
My Dockerfile goes as follows:
FROM node:6.2.0 # Create app directory RUN mkdir -p /usr/src/app WORKDIR /usr/src/app # Install app dependencies COPY package.json /usr/src/app/ RUN npm install # Thumbd RUN npm install -g thumbd RUN mkdir -p /var/log/ RUN echo "" > /var/log/thumbd.log RUN thumbd server --aws_key=<KEY> --aws_secret=<SECRET> --sqs_queue=<QUEUE> --bucket=<BUCKET> --aws_region=us-west-1 --s3_acl=public-read # Bundle app source COPY . /usr/src/app EXPOSE 8080 CMD npm run build && npm start
One Solution collect form web for “How should I run thumbd as a service inside a Docker container?”
It’s probably easiest to run thumbd in it’s own container due to the way it works without direct links to your application. Docker likes to push the idea of a single process per container too.
FROM node:6.2.0 # Thumbd RUN set -uex; \ npm install -g thumbd; \ mkdir -p /var/log/; \ touch /var/log/thumbd.log CMD thumbd server --aws_key=<KEY> --aws_secret=<SECRET> --sqs_queue=<QUEUE> --bucket=<BUCKET> --aws_region=us-west-1 --s3_acl=public-read
You can use Docker Compose to orchestrate running multiple containers in your project.
If you really want to run multiple processes in a container, use an init system like s6 or possibly supervisord.