Ram

Lesson 4 of 6

Ports & Volumes

Expose network services and persist data outside a container layer.

Introduction

Port publishing maps a host port to a port inside the container.

Volumes persist or share data independently of the container lifecycle.

Key insight

Expose network services and persist data outside a container layer.

Example

docker run -p 3000:3000 -v app-data:/data my-app

Read the example line by line, then try changing one value.

Real-world example

Ports & Volumes helps developers build useful applications.

Practice challenge

Which host port receives traffic in the example command?

Previous
Next