Creating more dynamic containers

We can create better containers than just fixing their usage in advance and executing them. Maybe part of the command is the one to keep (like we always want the OpenVPN binary and options to be executed, no matter what), maybe everything needs to be overridden (that's the toolbox container model, such as a /bin/bash command by default, but any other command given in argument can otherwise be executed), or a combination of the two, for a much more dynamic container.

Getting ready

To step through this recipe, you will need a working Docker installation.

How to do it…

To have a fixed command executed by the container, use the ENTRYPOINT instruction. Use an array if the command is followed by arguments to be enforced: ...

Get Infrastructure as Code (IAC) Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.