Book Image

Configuration Management with Chef-Solo

By : Naveed ur Rahman
Book Image

Configuration Management with Chef-Solo

By: Naveed ur Rahman

Overview of this book

Table of Contents (13 chapters)

Dockerfiles


As we have seen, we can execute individual commands from the Shell. Docker provides a decent method to invoke several commands and instructs the new container to perform a specific job.

Dockerfiles is a script based on different Docker commands. Each command contains an instruction, and it configures the new machine step by step. It can contain all the information from pulling a repository to starting any server.

They have a clean and simple syntax that makes a file more readable and clear. It is designed to be self-explanatory and allows commenting like other programming languages.

Here is an example of a file syntax:

# Comments
command argument argument …
# To echo Hello World
RUN echo "Hello World"

Let's create a basic Dockerfile and use the same example of Hello World as follows:

  1. Add the following content to Dockerfile:

    # Dockerfile
    FROM ubuntu
    RUN echo "Hello World"
  2. Build the Docker container with the following command:

    $ sudo docker build -t local/test_docker
    
  3. Our new container...