I\'m setting up a simple image: one that holds Riak (a NoSQL database). The image starts the Riak service with riak start
as a CMD. Now, if I run it as a daemon
"If I run it using docker run -i -t quintenk/riak-dev /bin/bash the riak process is not started"
It sounds like you only want to be able to monitor the log when you attach to the container. My use case is a little different in that I want commands started automatically, but I want to be able to attach to the container and be in a bash shell. I was able to solve both of our problems as follows:
In the image/container, add the commands you want automatically started to the end of the /etc/bash.bashrc
file.
In your case just add the line /bin/riak start && tail -F /var/log/riak/erlang.log.1
, or put /bin/riak start
and tail -F /var/log/riak/erlang.log.1
on separate lines depending on the functionality desired.
Now commit your changes to your container, and run it again with: docker run -i -t quintenk/riak-dev /bin/bash
. You'll find the commands you put in the bashrc are already running as you attach.