Book Image

Infrastructure as Code (IAC) Cookbook

By : Stephane Jourdan, Pierre Pomès
Book Image

Infrastructure as Code (IAC) Cookbook

By: Stephane Jourdan, Pierre Pomès

Overview of this book

Para 1: Infrastructure as code is transforming the way we solve infrastructural challenges. This book will show you how to make managing servers in the cloud faster, easier and more effective than ever before. With over 90 practical recipes for success, make the very most out of IAC.
Table of Contents (18 chapters)
Infrastructure as Code (IAC) Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Docker usage overview


This section is an introduction to Docker for newcomers, and can be used as a refresher for others. We'll see how to quickly use Docker to achieve some tasks such as executing an Ubuntu container or networked webserver, sharing data with a container, building an image, and accessing a registry other than the default one.

Getting ready

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

How to do it…

We'll quickly manipulate Docker, so we're up and running with some basic usage.

Running Bash in an Ubuntu 16.04 container

To execute /bin/bash in an Ubuntu container, tag 16.04 (ubuntu:16.04). Our environment will be interactive (use -i) and we want a pseudo-terminal to be allocated (use -t). We want the container to be destroyed afterwards (use --rm):

$ docker run -it --rm ubuntu:16.04 /bin/bash
root@d372dba0ab90:/# hostname
d372dba0ab90

We've run our first container! Now do whatever you want with it. Quitting it destroys it and its content is lost forever...