簡體   English   中英

Gluster 的 Dockerfile... 創建容器時無法啟動服務

[英]Dockerfile for Gluster... Can't get the service to start when the container is created

當前 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"]

使用它,容器可以完美啟動......但是正在安裝的服務(Gluster)沒有啟動。

我嘗試了 RUN、CMD 和 ENTRYPOINT 腳本的組合來執行“service glusterd start”(啟動 Gluster 守護進程的命令)的變體,但這些組合:

  • 導致容器在創建時退出
  • 導致容器崩潰的錯誤

我可以確認“service glusterd start”是需要運行的正確命令,如:

  • 我可以通過 SSH 連接到正在運行的容器/pod
  • 確認 Gluster 守護進程沒有運行
  • 在容器/pod 中運行“service glusterd start”沒有錯誤
  • 運行“service glusterd start”后確認Gluster守護進程已經啟動

關於如何在 dockerfile 中創建容器時執行“service glusterd start”的任何想法?

真正的功勞歸功於評論中的 DaveMaze……他關於 service/systemctl 和 CMD 的說明引導我走上了一條最終成功的道路:

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

完美運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM