簡體   English   中英

如何在 eclipse-che 中加載 dockerimage?

[英]How do I load a dockerimage in eclipse-che?

我正在嘗試在 openshift.io 上加載 docker-image,所以我嘗試僅使用“hello-world”作為我的 docker 圖像,這是我的 devfile

metadata:
  name: test
attributes:
  persistVolumes: 'false'
components:
  - mountSources: true
    endpoints:
      - name: hello
        port: 4200
    memoryLimit: 1Gi
    type: dockerimage
    image: 'hello-world'
    alias: hello-world
apiVersion: 1.0.0

但是我收到此錯誤Error: Failed to run the workspace: "The following containers have terminated: hello-world: reason = 'Completed', exit code = 0, message = 'null'"自定義圖像不會發生這種情況由 eclipse 提供,那么我需要更改什么才能在 openshift.io 上獲得 docker-image 工作? 據我所知,我無法編輯“Dockerfile”,我只能從 docker 注冊表中提取圖像。

這看起來像 hello-world 圖像退出的進入過程。 默認情況下,您的圖像不應退出,或者您應該使用不會在您的 devfile 上退出的命令覆蓋默認輸入命令。 您可以嘗試在dockerimage組件中添加類似下面的內容。

     command: ['tail']
     args: ['-f', '/dev/null']

也看看這個例子

dockerimage 的 command 屬性與其他 arguments 一起,用於修改從鏡像創建的容器的入口點命令。 在 Eclipse Che 中,需要容器無限期地運行,以便您可以隨時連接到它並在其中執行任意命令。 因為 sleep 命令的可用性和對它的 infinity 參數的支持是不同的,並且取決於特定圖像中使用的基本圖像,所以 Che 無法自行自動插入此行為。 但是,您可以利用此功能來啟動具有修改配置的必要服務器等。

要使 dockerimage 組件能夠訪問項目源,您必須將 mountSources 屬性設置為 true。

metadata:
  name: test
attributes:
  persistVolumes: 'false'
components:
  - mountSources: true
    endpoints:
      - name: hello
        port: 4200
    memoryLimit: 1Gi
    type: dockerimage
    image: 'hello-world'
    alias: hello-world
    command: ['sleep', 'infinity']

暫無
暫無

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

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