docker network create --driver bridge my-bridge-net
docker run -d --network my-bridge-net nginx
- To view container logs, enter:
docker logs CONTAINER
- To view logs for all tasks of a service, execute:
docker service logs SERVICE
- To view Docker daemon logs, input:
sudo jounralctl -u docker
The host port is the port that will listen on the host. Requests to that port on the host will be forwarded to the CONTAINER_PORT inside the container docker run -d -p HOST_PORT:CONTAINER_PORT IMAGE
Host
This driver connects the container directly to the host’s networking stack. It provides no isolation between containers or between containers and the host.
docker run --net host nginx
Bridge
This driver uses virtual bridge interfaces to establish connections between containers running on the same host.
docker network create --driver bridge my-bridge-net
docker run -d --network my-bridge-net nginx
Overlay
This driver uses a routing mesh to connect containers across multiple Docker hosts, usually in a Docker swarm
docker network create --driver overlay my-overlay-net
docker service create --network my-overlay-net nginx
MACVLAN This driver connect containers directly to the host’s network interfaces, but uses special configuration to provide isolation.
docker network create -d macvlan --subnet 192.168.0.0/24 --gateway 192.168.0.1 -o parent=eth0 \ my-macvlan-net docker run -d --net my-macvlan-net nginx
None
This driver provides sandbox isolation, but it does not provide any implementation for networking between containers or between containers and the host.
docker run --net none -d nginx
Understand the Container Network Model and how it interfaces with the Docker engine and network and IPAM drivers
???