Skip to content
Start a container and allow traffic from Port on Host Machine
docker container run -p <host_port>:<docker_port> -d <image>
Finding traffic and protocol of a particular container
docker container port <container_id>
Finding docker container IP
docker container inspect <container_id>

#Formatting the output to just get the container IP

docker container inspect -f '{{.NetworkSettings.IPAddress}}' <container_id>
Finding all containers
docker container ps

Bridge acts as a virtual private network in docker. Each container in the same private network can communicate with each other without any port but if it has to communicate with the host machine then port is required to open the connection with host.

Docker Image

Tagging image in docker
Tag to an image can be added during build or explicit using docker tag

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

Example

docker tag ubuntu ubuntutest (This will create an copy of the ubuntu image with ubuntutest name, we can also specify a particular custom tag)
Pushing Image to Docker
docker image push USER(docker_hub username)/Image-name

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.