In previous article we explored the basics of containers and docker concepts, now we will dig deeper and will further explorer the concept of docker images.
Docker Images are the blueprints or templates used to create / run a container. Some of the common examples of docker images can be.
- Apache HTTP Server
- Redis Server
- MySQL DBMS
- Java Jar or War package
- WordPress Image (with Apache Server, PHP Binaries, MySQL installation and copy of wordpress software).
Every docker image will start with a base image such as Ubuntu linux image and you can your image on top of it. However instead of building your image from scratch you can reuse many pre-built images to save your effort. For example to build a wordpress website image you can make use of already available Apache HTTP server and MySQL docker images.
Dokcerfile is used to create a docker image, Dockerfile is just a plain text file with series of instructions / commands for docker image. Some of the common tasks (instructions) within Dockerfile are.
- Create an environment variable.
- Create a directory or file.
- Start HTTP server.
Instructions within docker file will be executed in order while building (using
docker build command) docker image and each instruction will will create a new layer within this docker image. In next article we will explore layers within docker image.
Docker images are highly portable and can run on any operating system where docker engine is available.