Skip to main content

Docker Commands: docker build

Docker Commands: docker build


docker build -t <DockerID>/<ImageName> <Dockerfile name>

To build a new image using a Dockerfile.


Using docker build is the preferred way to build a Docker Image. The build instructions are laid out in the Dockerfile, which allows an automated, documented and repeatable way to generate a specific Docker image.

Associated with the docker build command is its context. The build’s context is the files at a specified location: PATH or URL.

PATH is a directory on your local filesystem
URL is a Git repository location

A context is processed recursively, i.e. any subdirectories in the PATH and any submodules in the URL are processed for objects.

By default the build instructions are read from a file called Dockerfile at the root (or top level) of your context. In the example below,  if the docker build command is run from a subdirectory called Files, this becomes its context. The Docker daemon searches this directory and any subdirectories for objects it needs, e.g. Dockerfile.


Note: if the Dockerfile is located outside the context, use the -f option to specify the Dockerfile, e.g. $ docker build -f /path/to/a/Dockerfile .

Note: You can specify a repository (and tag) at which to save the new image, e.g. $ docker build -t neokobo/alp01data:1.0 .

Reference:

Creative Commons License Licensed under a Creative Commons Attribution 4.0 International License.

Comments

Popular posts from this blog

3.2.13 DNS poisoning and ARP poisoning

DNS poisoning and ARP poisoning DNS and ARP poisoning are types of man-in-the-middle (MITM) attacks, which are types of spoofing attacks. A spoofing attack is an attempt by someone to masquerade as someone else. Address Resolution Protocol (ARP) cache poisoning (sometimes also known as ARP Poison Routing) allows an attacker on the same network segment (subnet) as its victims to eavesdrop on all network traffic between the victims. ARP poisoning, tries to convince the network that the attacker's MAC address is the one associated with an IP address so that traffic sent to that IP address is wrongly sent to the attacker's machine. In ARP poisoning, the MAC (Media Access Control) address table of the victim host is ‘poisoned’ with false data. Incorrect data for a victim host is interjected into the MAC table of the victim host to force the victim to communicate with the wrong host. By faking this value, it is possible to make it look as if the data came from a network that

Docker Command Flowchart

Docker Command Flowchart Inspired by a post at www.troubleshooters.com this flowchart illustrates some of the Docker objects and the commands that apply to them. For example, to preserve changes made in a container object and convert it into an image , use the docker commit command. References: http://www.troubleshooters.com/linux/docker/docker_newbie.htm Licensed under a Creative Commons Attribution 4.0 International License .

Docker Compose

Docker Compose Particularly with multi-tiered applications, your Dockerfile and runtime commands get increasingly complex. Docker Compose is a tool to streamline the definition and instantiation of multi-tier, multi-container Docker applications. Compose requires a single configuration file and a single command to organize and spin up the application tier. Docker Compose simplifies the containerization of a multi-tier, multi-container application, which can be stitched together using the docker-compose.yml configuration file and the docker-compose command to provide a single application service. The Compose file provides a way to document and configure all of the application’s service dependencies (databases, queues, caches, web service APIs, etc.) Docker Compose defines and runs complex services: define single containers via Dockerfile describe a multi-container application via single configuration f