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

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.

主站蜘蛛池模板: 利津县| 齐河县| 甘谷县| 辰溪县| 区。| 洞口县| 新疆| 普格县| 伊金霍洛旗| 常宁市| 南漳县| 荣昌县| 肇庆市| 乐平市| 新余市| 沛县| 文安县| 读书| 墨玉县| 都江堰市| 宣恩县| 桦川县| 娱乐| 左贡县| 博兴县| 耒阳市| 乌拉特中旗| 白沙| 西畴县| 抚顺市| 汕头市| 府谷县| 淮南市| 绥德县| 奉贤区| 潍坊市| 沾益县| 漳州市| 西林县| 牙克石市| 特克斯县|