From the course: Learning Docker

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Binding ports to your container

Binding ports to your container - Docker Tutorial

From the course: Learning Docker

Binding ports to your container

- [Instructor] Up to this point, all of the containers we've created use data imports within themselves. This is somewhat useful, but not nearly as useful as being able to access data imports from your own computer into those containers. Let's learn how to do that. First, let's explore accessing container network services from your host. Docker provides the ability to access network ports within the container, with something called port binding. This feature allows Docker to take a port on your machine, and map it to a port within the container. This section contains a docker file that updated our little server from earlier. That docker file is called web hyphen server dot docker file. First, let's build an image from it, called our web server, with docker build dash t, our web server. Then the dash f option, and then the name of the Docker file, which is called web hyphen server dot Dockerfile. And then…

Contents