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 volume recreates a new target path every time
  • Docker-machine - IP address conflict
  • Connecting zeppelin docker with hive
  • Java JVM on Docker/CoreOS
  • How can I change the docker id and name
  • What does “attach to standard streams” mean in docker?
  • 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
    

  • Concourse Pipeline failing for simple pipleline
  • Use container environment variable in docker run without using bash -c
  • Unable to browse nodejs web app running docker container
  • FTP access inside docker for a PHP envrionnement
  • Rspec test failing against Docker container
  • AWS S3 Elastic Beanstalk Docker - /dev/fus: Operation not permitted
  • 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.