官术网_书友最值得收藏!

What are the key building blocks of Dockers containers?

For setting up our development environment, we will rely on Docker containers, and assemble them together using the tool called Docker compose, which we shall learn about a little later.

Let us understand some of the following, which can also be termed as the key building blocks of Docker containers:

  • Docker image: In simple terms, a Docker image can be thought of as a class in Java. Docker containers can be thought of as running instances of the image as like having one or more instances of a Java class. Technically speaking, Docker images consist of a list of layers that are stacked on top of each other to form a base for the containers' root file system. The following diagram represents a command which can be used to create a Docker container using an image named hello-world:
Figure 1.19: Docker command representing creation of Docker container using a Docker image.

In order to set up our development environment, we will require the images of the following to create the respective Docker containers: Tomcat and MySQL

  • Dockerfile: A Dockerfile is a text document that contains all the commands which could be called on the command line to assemble or build an image. The docker build command is used to build an image from a Dockerfile and a context. In order to create custom images for Tomcat and MySQL, it may be required to create a Dockerfile, and then build the image. The following is a sample command for building an image using a Dockerfile:
    docker build -f tomcat.df -t tomcat_debug .

The preceding command would look for the Dockerfile tomcat.df in the current directory specified by ".", and build the image with the tag tomcat_debug.

主站蜘蛛池模板: 金塔县| 瑞昌市| 石景山区| 县级市| 云南省| 泽普县| 巴林右旗| 房产| 铁岭市| 通河县| 扶沟县| 涟源市| 青铜峡市| 大竹县| 玉门市| 东城区| 秦皇岛市| 北票市| 祁阳县| 阜宁县| 麻江县| 鄂托克旗| 宜兴市| 大城县| 鄱阳县| 罗源县| 五指山市| 石泉县| 永丰县| 宣汉县| 纳雍县| 抚顺市| 亳州市| 洪湖市| 西昌市| 南宫市| 苏州市| 华坪县| 筠连县| 宜君县| 中卫市|