I thought I understood Docker until I saw the BusyBox docker image

后端 未结 3 1150
我寻月下人不归
我寻月下人不归 2020-12-23 19:52

I thought I understood Docker. I understood it as a way to package up software with lots of dependencies..to basically create a little world where absolutely everything is t

3条回答
  •  萌比男神i
    2020-12-23 20:17

    In addition to being a convenient base to use for other docker images. Busybox also makes a very convenient initContainer for kubernetes: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/

    Say you need something to happen that sets up the pod filesystem before your real container starts running then busybox is great at this..

    As a concrete example the official redis image doesn't run redis as root and so it cannot access the filesystem. If you were running redis with disk backup (in appendonly mode for example) you would need to open up that disk permission for it.

    a valid (though probably hacky) initContainer for a statefulSet of redis might looks something like so:

          initContainers:
          - name: redis-data-permission-fix
            image: busybox
            command: ["/bin/chmod", "-R", "777", "/opt/data/redis"]
            volumeMounts:
            - name: data
              mountPath: /opt/data/redis
    

提交回复
热议问题