Docker – 07- Container Networking,IPAddress,Port

docker-turtles-banner-network-copy

Docker Container Networking,IPAddress,Port

Firstly we will create the web server

docker run -d –publish-all jpetazzo/web

Ports

0.0.0.0:32758:8000   -> Port Mapping

:32768-> Host Port Number

:8000-> Containers Port Number

curl localhost:32768

Get the Host Port number by container number

docker port <container_id> 8000

You can assign manually port

docker run -d -p 88:8000 jpetazzo/web

You can get the container  private ip address

docker inspect –format ‘{{.NetworkSettings.IPAdress}}’ <container_id>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s