2 years ago

#42433

test-img

Tony

How to deal with dynamic libraries in openshift init containers

Right now I have a custom image for ffmpeg, which has the burden of having to maintain the custom image. I was thinking of a way to do this more efficiently and came across init containers. I think init containers are a good solution to make sure that I don't have to maintain a custom image and because it imposes the separation of concerns principle.

In my deployment config, I made an init container where I retrieve the ffmpeg image from docker and copy it.

    kind: DeploymentConfig

    spec:
      initContainers:
        - name: ffmpeg
          image: 'docker.io/jrottenberg/ffmpeg:4.4-centos8'
          command:
            - cp
            - /usr/local/bin/ffmpeg
            - /opt/ffmpeg/
          resources: {}
          volumeMounts:
            - name: opt-ffmpeg
              mountPath: /opt/ffmpeg
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      containers:
          name: example
          image: example/example:v1
          volumeMounts:
            - name: ffmpeg
              mountPath: /opt/ffmpeg
      volumes:
        - name: ffmpeg
          emptyDir: {}

The problem is that ffmpeg is missing a few libraries. Ffmpeg is looking for shared libraries and is not able to find them. I know that static libraries provide everything, but I haven't found a good static library to use yet.

sh-4.4$ ldd ffmpeg 
    linux-vdso.so.1 (0x00007ffe5876a000)
    libnss_wrapper.so => /lib64/libnss_wrapper.so (0x00007f1f19b37000)
    libavdevice.so.58 => not found
    libavfilter.so.7 => not found
    libavformat.so.58 => not found
    libavcodec.so.58 => not found
    libavresample.so.4 => not found
    libpostproc.so.55 => not found
    libswresample.so.3 => not found
    libswscale.so.5 => not found
    libavutil.so.56 => not found
    libm.so.6 => /lib64/libm.so.6 (0x00007f1f197b5000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1f19595000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f1f191d0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f1f18fcc000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1f19d46000)

Does anyone know a way to link dynamic libraries? Or does anyone have a suggestion how I can use ffmpeg without a custom image?

Thanks in advance.

kubernetes

openshift

openshift-origin

redhat-containers

0 Answers

Your Answer

Accepted video resources