InterviewSolution
| 1. |
What are Dockerfiles? |
|
Answer» DOCKERFILE is a text file that has instructions to build a Docker image. All commands in dockerfile could also be used from the command line to build images. docker build command creates an image from the dockerfile and its CONTEXTS. Contexts are a set of files at a PATH/URL. URL could be any repository location of any version control system. PATH could also be a location in your local system. The following command shows building docker image from the contexts in the current directory and send the context to the docker daemon $ docker build . Sending build context to Docker daemon 6.51 MB ...Root directory or path is not preferred as context path because the entire contents of your hard drive will be transferred to the Docker daemon. Docker daemon performs a validation of the dockerfile before running instructions in dockerfile. Docker daemon takes on the instructions one by one creating an updated image each time. Sample Dockerfile : FROM ubuntu:16.04 COPY . /app RUN make /app CMD PYTHON /app/app.pyEach instruction in a dockerfile creates one read-only layer:
|
|