Skip to main content

Dockerfile and Images

Dockerfile Basics

0:00
LearnStep 1/2

Dockerfile Introduction

Dockerfile Basics

A Dockerfile is a text file with instructions for building Docker images.

Basic Dockerfile

dockerfile

Building the Image

bash

Key Instructions

  • FROM: Base image to start from
  • WORKDIR: Set working directory
  • COPY: Copy files from host to image
  • RUN: Execute commands during build
  • EXPOSE: Document which ports are used
  • CMD: Default command when container starts