--- tags: - 🚩purpose/ℹ️documentation - 🏷️topic/💾software/docker --- Docker containers are configured with [`ENTRYPOINT`s](https://docs.docker.com/engine/reference/builder/#entrypoint), or commands that are run when the container is initialized. This can be something like the container base image’s `/sbin/init` or [tinyinit](https://savannah.nongnu.org/projects/tinyinit). Sometimes however, [[NVIDIA in a Non-GNU Environment#Run `ldconfig` after mounting|there is a need to run something before a container’s normal entrypoint]]. Under Docker Compose this is as easy as injecting a command before the container [entrypoint](https://docs.docker.com/compose/compose-file/#entrypoint): ```yaml entrypoint: /bin/sh command: - -c - | # f.e. cache new libs ldconfig # anything else you need to do pre-init can go here # the original entrypoint/command should go here # for example: /sbin/init -- /bin/supercoolprogram ``` I was inspired by [@regbo on GitHub](https://github.com/goauthentik/authentik/issues/2364#issuecomment-1341627328) and their use of YAML conventions to make injecting scripts easier. >[!WARNING] Beware image updates >If there is an update to the underlying image that changes the entrypoint, you must update your override to point to it, else the container will likely fail to start.