O'Reilly logo

Infrastructure as Code (IAC) Cookbook by Pierre Pomes, Stephane Jourdan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required