Docker Images and Dockerfile
Learn about Docker images and how they are used in Dockerfile.
We'll cover the following
Images
A Docker image is a snapshot of a file and operating system with libraries and application executables. In essence, an image is a recipe or template for creating a container. It’s similar to how some computer languages let you define a reusable class
template for instantiating objects of the same type.
Any number of containers can be started from a single image. This permits scaling on production servers, although you’re unlikely to launch multiple containers from the same image during development.
The Docker Hub provides a repository of commonly-used images for:
- dependencies such as NGINX, MySQL, MongoDB, Elasticsearch, Redis, etc.
- language runtimes or frameworks such as Node.js, PHP, Python, Ruby, Rust), and any other language you’ve heard of.
- applications such as WordPress, Drupal, Joomla, Nextcloud, etc. These often require additional containers such as databases.
🔔 Reminder: Sign-up for a Docker Hub account if you’d like to publish your own images.
Dockerfile
An image is configured using a Dockerfile. It typically defines:
Get hands-on with 1400+ tech skills courses.