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:

  • Docker image size
  • Can't pull kubernetes dns container from behind proxy
  • Docker swarm: How to specify cpu units provided by a node?
  • Using “tail -f /dev/null” to keep container up fails unexpectedly
  • How to deploy multiple docker.io containers in one host?
  • NGINX based sample website in a container
  • 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
    

  • Silently Installing pecl modules (e.g. pecl_http) Inside a Docker Container?
  • Docker's healthcheck on Windows container and exit code (“||” linux equivalent)
  • Copy files between docker machines
  • interactive docker build from dockerfile?
  • How packaging and deployment works in Azure ?
  • Using Docker file sharing but file does not seem to be updating
  • 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.