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

Networking and Persistent Storage

We learned a lot about Docker concepts in the previous chapter. We know that the container is a runtime of an image. It will contain your Java application altogether with all needed dependencies, such as JRE or an application server. But, there are rare cases when the Java application is self-sufficient. It always needs to communicate with other servers (as a database), or expose itself to others (as a web application running on the application server which needs to accept requests coming from the user or from the other applications). It's time to describe ways to open the Docker container to the outside world, networking, and persistent storage. In this chapter, you are going to learn how to configure networking, and expose and map network ports. By doing that, you will enable your Java application to communicate with other containers. Imagine the following scenario: you can have one container running a Tomcat application server with your Java application, communicating with another container running a database, PostgreSQL for example. While the Kubernetes approach to networking is somewhat different in comparison to what Docker provides by default, let's focus on Docker itself briefly now. We are going to cover Kubernetes' specific networking later on. The container communication with the outside world is not only about networking; in this chapter, we will also focus on data volumes as a way to persist the data between container run and stop cycles.

This chapter covers the following topics:

  • Docker network types
  • Networking commands
  • Creating a network
  • Mapping and exposing ports
  • Volume-related commands
  • Creating and removing volumes

Let's begin with Docker networking.

主站蜘蛛池模板: 富阳市| 山西省| 航空| 大新县| 天峻县| 镇康县| 云阳县| 鄂托克前旗| 杨浦区| 志丹县| 上栗县| 武胜县| 明水县| 若尔盖县| 敖汉旗| 哈尔滨市| 临清市| 罗平县| 梁河县| 老河口市| 会宁县| 清水河县| 闵行区| 吴江市| 遵化市| 葫芦岛市| 绩溪县| 公安县| 万盛区| 南乐县| 鹤峰县| 长春市| 阿拉善左旗| 平泉县| 巫溪县| 宜丰县| 扎兰屯市| 屏东市| 岑巩县| 深圳市| 海城市|