title: Run process with non-root user in docker container
body: <p>I'm building redis sentinal image that <code>run.sh</code> should run as non-rootuser</p>
  
  <p><code>run.sh</code></p>
  
  <pre><code>  while true; do
      master=$(redis-cli -h ${REDIS_SENTINEL_SERVICE_HOST} -p ${REDIS_SENTINEL_SERVICE_PORT} --csv SENTINEL get-master-addr-by-name mymaster | tr ',' ' ' | cut -d' ' -f1)
      if [[ -n ${master} ]]; then
        master="${master//\"}"
      else
        master=$(hostname -i)
      fi
  
      redis-cli -h ${master} INFO
      if [[ "$?" == "0" ]]; then
        break
      fi
      echo "Connecting to master failed.  Waiting..."
      sleep 10
    done
  
    sentinel_conf=/home/ubuntu/sentinel.conf
  
    echo "sentinel monitor mymaster ${master} 6379 2" &gt; ${sentinel_conf}
    echo "sentinel down-after-milliseconds mymaster 60000" &gt;&gt; ${sentinel_conf}
    echo "sentinel failover-timeout mymaster 180000" &gt;&gt; ${sentinel_conf}
    echo "sentinel parallel-syncs mymaster 1" &gt;&gt; ${sentinel_conf}
    echo "bind 0.0.0.0" &gt;&gt; ${sentinel_conf}
  
    redis-sentinel ${sentinel_conf} --protected-mode no
  }
  
  function launchslave() {
    while true; do
      master=$(redis-cli -h ${REDIS_SENTINEL_SERVICE_HOST} -p ${REDIS_SENTINEL_SERVICE_PORT} --csv SENTINEL get-master-addr-by-name mymaster | tr ',' ' ' | cut -d' ' -f1)
      if [[ -n ${master} ]]; then
        master="${master//\"}"
      else
        echo "Failed to find master."
        sleep 60
        exit 1
      fi
      redis-cli -h ${master} INFO
      if [[ "$?" == "0" ]]; then
        break
      fi
      echo "Connecting to master failed.  Waiting..."
      sleep 10
    done
    sed -i "s/%master-ip%/${master}/" /redis-slave/redis.conf
    sed -i "s/%master-port%/6379/" /redis-slave/redis.conf
    redis-server /redis-slave/redis.conf --protected-mode no
  </code></pre>
  
  <p><code>Dockerfile</code></p>
  
  <pre><code>FROM alpine:3.4
  
  RUN apk add --no-cache redis sed bash busybox-suid
  #su: must be suid to work properly
  COPY redis-master.conf /redis-master/redis.conf
  COPY redis-slave.conf /redis-slave/redis.conf
  RUN adduser -D ubuntu
  USER ubuntu
  COPY run.sh /home/ubuntu/run.sh
  CMD [ "sh", "/home/ubuntu/run.sh" ]
  ENTRYPOINT [ "bash", "-c" ]
  </code></pre>
  
  <p>I deployed in Openshift. The container is continuously restarting and I dont see any logs also. I have seen the some logs before when the "run.sh" is root(default) i.e not mentioned any <code>adduser</code> in <code>Dockerfile</code>.</p>