admin管理员组

文章数量:1122796

I am trying to deploy the standard OTel Collector Contrib Docker image to Cloud Foundry.

Following OTel's documentation of how to configure the collector I am trying to inject the OTel collector's configurations via an environment variable by specifying the following:

--config=env:MY_CONFIG_IN_AN_ENVVAR

In order to do that, I need to override the OTel Collector image's start command (CMD) as documented in the Cloud Foundry documentation, and I am using a CF manifest.yaml file to do so.

The original CMD in the image is given as:

CMD ["--config" "/etc/otelcol-contrib/config.yaml"]

So I thought, I'd start by overriding CMD with its original value, just to test, if overriding works at all. Here is the according manifest.yaml:

applications:
- name: occ
  memory: 256M
  disk_quota: 512M
  instances: 1
  health-check-type: process
  docker:
    image: otel/opentelemetry-collector-contrib:0.114.0
  command: "--config=/etc/otelcol-contrib/config.yaml"
    
  routes: 
  - route: occ.some.domain
    protocol: http2

When I cf push that docker image, deployment fails with the following error:

   2024-11-21T23:15:07.83+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 stopping instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:07.83+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 destroying container for instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:07.83+0100 [API/36] OUT Process has crashed with type: "web"
   2024-11-21T23:15:07.85+0100 [API/36] OUT App instance exited with guid 1b878955-8f60-4c17-ba79-ed642b842fe5 payload: {"instance"=>"c8b25623-18ad-48be-76f0-fe2c", "index"=>0, "cell_id"=>"36978039-f310-488f-84df-e717cacf7f21", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>1, "crash_timestamp"=>1732227307824196148, "version"=>"495c31ed-0cd1-4120-961b-3d9add207828"}
   2024-11-21T23:15:07.87+0100 [CELL/0] OUT Cell 55878f2d-faab-4a94-96ba-ffe97bd7e165 creating container for instance e3175892-6acc-4b7a-4e4c-2d3e
   2024-11-21T23:15:08.22+0100 [PROXY/0] OUT Exit status 137
   2024-11-21T23:15:08.87+0100 [CELL/0] OUT Cell 36978039-f310-488f-84df-e717cacf7f21 successfully destroyed container for instance c8b25623-18ad-48be-76f0-fe2c
   2024-11-21T23:15:12.27+0100 [CELL/0] OUT Security group rules were updated
   2024-11-21T23:15:12.34+0100 [CELL/0] OUT Cell 55878f2d-faab-4a94-96ba-ffe97bd7e165 successfully created container for instance e3175892-6acc-4b7a-4e4c-2d3e
   2024-11-21T23:15:12.71+0100 [APP/PROC/WEB/0] OUT Exit status 1
   2024-11-21T23:15:12.71+0100 [APP/PROC/WEB/0] ERR Failed to run: no such file or directory
   2024-11-21T23:15:12.71+0100 [CELL/SSHD/0] OUT Exit status 0

If I deploy without the command override, the image starts perfectly fine.

What could be the problem?

本文标签: How to override start CMD of Docker Image on Cloud FoundryStack Overflow