Injecting Files and Commands into Docker Bootstrap Process
kpfleming is setting up a Discourse install using Docker-based instructions on a corporate network with HTTP/HTTPS proxies and a custom CA root certificate. To successfully pull from an HTTPS connection to Github, they need to inject a custom CA certificate into the container and run update-ca-certificates before the Git installation.
rking suggests using a before_code: hook to achieve this, providing an example of how to use the file: and exec: hooks to add a custom certificate and run commands. They also mention that binary files can be copied from the /shared directory.
I’m setting up a Discourse install using the Docker-based instructions; this is being done on a weird internal corporate network, that has both HTTP/HTTPS proxies and has a custom CA root certificate.
I’ve edited app.yml to add the http_proxy/https_proxy environment variables that are necessary to run Git to pull ‘pups’, but there don’t seem to be any provisions for injecting additional files (and commands to run) before that command is run. I’ll need to push a file into the container, add a line into a configuration file, and run ‘update-ca-certificates’ before the Git installation inside the container will be able to pull from an HTTPS connection to Github.
Alternatively, I could set Git’s global configuration in the container to disable SSL certificate verification, and I’ll probably edit the launcher script to do that as a temporary workaround. Just figured I’d post this here to record the situation, other people may run into a need for pushing additional files or commands into the container during the bootstrap.