- dockerfile used to build a docker container image - containers are based on images that include config and settings - dockerfile is a test file containing directives for creating a container image - `sudo docker build -f path/to_dockerfile -t image_name` to create a container image - alternative build command if dockerfile is in current directory: `sudo docker build -t image_name .` - dockerfile syntax ![[images/Pasted image 20250712191639.png]] - use FROM to specify a baseline/starter image to be customized - `.dockerignore` is an optional file that is typically in same directory as dockerfile - specifies files or directories to exclude from being added to a docker container image - `.dockerignore` syntax ![[images/Pasted image 20250712191927.png]] - one example dockerfile ![[images/Pasted image 20250712192217.png]] - specifies base image as ubuntu:latest - hub.docker is implied - runs commands within container - adds .py script and specifies where to place it on container fs: `/home/hello.py` - sets working directory to `/home` - second example dockerfile ![[images/Pasted image 20250712193133.png]]