#Mounting a writable volume on a Container without a writable file system

1 messages · Page 1 of 1 (latest)

scenic hatch
#

I am trying to use a file exporter in otel/opentelemetry-collector-contrib, without success yet. The documentation says to do something like

# linux needs +x to list a directory.  You can use a+ instead of o+ for the mode if you want to ensure your user and group has access.
mkdir --mode o+rwx file-exporter
# z is an SELinux construct that is ignored on other systems
docker run -v "./file-exporter:/file-exporter:rwz" -v "otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml" otel/opentelemetry-collector-contrib:latest

I tried using .with_mounted_cache but it did not work.

GitHub

Contrib repository for the OpenTelemetry Collector - open-telemetry/opentelemetry-collector-contrib

plucky umbra
#

here's an example on how you can use WithNewDirectory for that:

package main

import (
    "context"
)

type Scratch struct{}

func (m *Scratch) Test(ctx context.Context) []string {
    e, _ := dag.Container().WithDirectory("/somepath", dag.Directory().WithNewDirectory("")).Entries(ctx)
    return e
}
plucky umbra
scenic hatch
plucky umbra
#

@scenic hatch here's the fix: