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

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.

主站蜘蛛池模板: 曲阳县| 武功县| 双峰县| 安化县| 肥东县| 富民县| 湘潭县| 平度市| 灵台县| 盖州市| 巩留县| 尼木县| 中方县| 石阡县| 三江| 呈贡县| 白银市| 庐江县| 新乡市| 垦利县| 金溪县| 克什克腾旗| 策勒县| 益阳市| 新巴尔虎左旗| 弥勒县| 尚志市| 洛川县| 漳浦县| 东丽区| 阜新市| 张家港市| 贞丰县| 招远市| 绵阳市| 彭州市| 鄂托克旗| 永靖县| 谷城县| 凤山县| 嘉荫县|