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:

  • golang docker private github repository
  • Running nginx as non-root user on Openshift and listening on port 80
  • How to start service in docker container at start up
  • What Docker image size is considered 'too large'?
  • Docker wont build anymore after accedently trying to delete windowsfilter folder
  • Wildfly Docker Container Live Migration with CRIU fails
  • 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
    

  • Mount remote machine directory to its container with docker-machine on windows
  • Building Dockerfile fails when touching a file after a mkdir
  • docker not unzipping my files
  • docker-compose - No such service via Vagrant-Windows shells only
  • docker - build fails when COPYing file to root
  • Split Django project
  • 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.