☰ See All Chapters |
Docker FROM command
Docker FROM command sets the base image for the build process.
Below is the syntax of FROM command
FROM <baseimagename>[:<releasetag>] |
<baseimagename>: Name of the base image.
<releasetag>: Release tag of the base image. If release tag is not specified, then the tag latest is used.
Example:
FROM alpine:latest ----------------- FROM ubuntu:14.04 ----------------- FROM centos |
Docker build process will first look in the Docker host for the base image specified. If image not found in docker host then it will pull the image from the publicly available Docker Hub Registry. The docker build system will return an error if it cannot find the specified image in the Docker host and the Docker Hub Registry.
Docker allows multiple FROM command in a single Dockerfile in order to create multiple images. But using multiple FROM commands in a single file is not good. The Docker build system will pull all the images specified in the FROM command and may create conflicts.
All Chapters