Monday, December 10, 2018

Docker bulid

Docker bulid


I would start the game with creating my own Docker image with dockerfile...

The docker build command builds an image from a Dockerfile and a context
The build’s context is the set of files at a specified location PATH or URL
The PATH is a directory on your local filesystem. 
The URL is a Git repository location.

$ docker build .

Traditionally, the Dockerfile is located in the root of the context. 
You use the -f flag with docker build to point to a Dockerfile anywhere in your file system.

$ docker build -f /path/to/a/Dockerfile .

You can specify a repository and tag at which to save the new image if the build succeeds:

$ docker build -t kris/awesome-app .

To tag the image into multiple repositories after the build, add multiple -t parameters when you run the build command:

$ docker build -t kris/awesome-app:1.0.1 -t kris/awesome-app:latest .

Before the Docker daemon runs the instructions in the Dockerfile, it performs a preliminary validation of the Dockerfile and returns an error if the syntax is incorrect.

An example of content of sample Dockerfile:


   FROM ubuntu:18.04

    RUN apt-get update

    RUN apt-get install -y curl nginx


No comments: