Home > Net >  Dockerfile for Gluster... Can't get the service to start when the container is created
Dockerfile for Gluster... Can't get the service to start when the container is created

Time:10-25

Current dockerfile:

FROM ubuntu:latest

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:gluster/glusterfs-9 && \
    apt-get update && \
    apt-get install -y glusterfs-server

CMD ["/usr/sbin/init"]

Using this, the container starts perfectly... However the service being installed (Gluster) doesn't start.

I've tried combinations of RUN, CMD, & ENTRYPOINT scripts executing variations of "service glusterd start" (the command to start the Gluster daemon) but those combinations:

  • Cause the container to exit on creation
  • Cause errors that crash the container

I can confirm "service glusterd start" is the correct command that needs to be run, as:

  • I can SSH into the running container/pod
  • Confirm that the Gluster daemon is not running
  • Run "service glusterd start" in the container/pod without errors
  • Confirm that the Gluster daemon has started after running "service glusterd start"

Any ideas on how to execute "service glusterd start" at the container creation in the dockerfile?

CodePudding user response:

Real credit goes to DaveMaze in the comments... His note about service/systemctl and CMD lead me down a path that ended up working:

FROM ubuntu:latest

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:gluster/glusterfs-9 && \
    apt-get update && \
    apt-get install -y glusterfs-server

CMD glusterd -N

Works perfectly.

  • Related