Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Docker Workshop

You're reading from   The Docker Workshop Learn how to use Docker containers effectively to speed up the development process

Arrow left icon
Product type Paperback
Published in Oct 2020
Publisher Packt
ISBN-13 9781838983444
Length 792 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Authors (5):
Arrow left icon
Engy Fouda Engy Fouda
Author Profile Icon Engy Fouda
Engy Fouda
Onur Yılmaz Onur Yılmaz
Author Profile Icon Onur Yılmaz
Onur Yılmaz
Sathsara Sarathchandra Sathsara Sarathchandra
Author Profile Icon Sathsara Sarathchandra
Sathsara Sarathchandra
Aric Renzo Aric Renzo
Author Profile Icon Aric Renzo
Aric Renzo
Vincent Sesto Vincent Sesto
Author Profile Icon Vincent Sesto
Vincent Sesto
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface
1. Running My First Docker Container 2. Getting Started with Dockerfiles FREE CHAPTER 3. Managing Your Docker Images 4. Multi-Stage Dockerfiles 5. Composing Environments with Docker Compose 6. Introduction to Docker Networking 7. Docker Storage 8. CI/CD Pipeline 9. Docker Swarm 10. Kubernetes 11. Docker Security 12. Best Practices 13. Monitoring Docker Metrics 14. Collecting Container Logs 15. Extending Docker with Plugins Appendix

What Is a Dockerfile?

A Dockerfile is a text file that contains instructions on how to create a Docker image. These commands are known as directives. A Dockerfile is a mechanism that we use to create a custom Docker image as per our requirements.

The format of a Dockerfile is as follows:

# This is a comment
DIRECTIVE argument

A Dockerfile can contain multiple lines of comments and directives. These lines will be executed in order by the Docker Engine while building the Docker image. Like programming languages, a Dockerfile can also contain comments.

All statements starting with the # symbol will be treated as a comment. Currently, Dockerfiles only support single-line comments. If you wish you write a multi-line comment, you need to add the # symbol at the beginning of each line.

However, unlike most programming languages, instructions within the Dockerfile are not case-sensitive. Even though the DIRECTIVE is case-insensitive, it is a best practice to write all directives in uppercase to distinguish them from arguments.

In the next section, we will discuss the common directives that we can use in Dockerfiles to create a custom Docker image.

Note

If you are using ubuntu versions later than 18.04, there will be a prompt to enter time zone. Please suppress the prompt with ARG DEBIAN_FRONTEND=non_interactive

You have been reading a chapter from
The Docker Workshop
Published in: Oct 2020
Publisher: Packt
ISBN-13: 9781838983444
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime