Dockerfile Basics

Start Quiz

Study Flashcards

3 Questions

What statement is used to set environment variables for the container?

ENV

What statement defines the entire command to be executed?

CMD

What statement allows you to expose ports on a host machine so that containers can use them?

EXPOSE

Study Notes

  • The FROM statement in a Dockerfile defines which image to download and start from.
  • A Dockerfile can have multiple FROM statements, which means that the Dockerfile produces more than one image.
  • The MAINTAINER statement defines the author of the Dockerfile and how to contact them in case of any bugs.
  • The RUN statement defines what process will be running inside the container at runtime by specifying a command to run through the shell and waiting for it to finish.
  • The ADD statement is used to copy new files, directories, or remote file URLs into the filesystem of the image.
  • The ENV statement is used to set environment variables for the container.
  • The ENTRYPOINT statement specifies the starting of the expression to use when starting your container.
  • The CMD statement defines the entire command to be executed.
  • The CMD [ command ] syntax allows you to run multiple commands together.
  • The Dockerfile is a text file used by the Docker engine to create a container from an image.
  • A Dockerfile can contain instructions for how to build a container from an image.
  • The image can be a snapshot of an existing container, or it can be created from scratch.
  • The EXPOSE statement allows you to expose ports on a host machine so that containers can use them.
  • The WORKDIR statement sets the working directory for the container.
  • The VOLUME statement defines shared or ephemeral volumes on a host machine.

Test your knowledge of Dockerfile instructions and their functions in containerization. Learn about defining images, setting environment variables, file operations, and container commands.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser