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

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.

主站蜘蛛池模板: 简阳市| 南皮县| 满洲里市| 怀来县| 济源市| 岳西县| 安溪县| 木里| 兰考县| 灵石县| 阳江市| 师宗县| 新郑市| 蓬安县| 镇康县| 孟津县| 沧源| 芷江| 柯坪县| 西平县| 慈利县| 青海省| 肃宁县| 邢台县| 启东市| 年辖:市辖区| 龙江县| 蛟河市| 靖江市| 白城市| 佛学| 甘谷县| 灵山县| 包头市| 南乐县| 黔江区| 湖北省| 五河县| 若尔盖县| 防城港市| 永仁县|