Network Flashcards

1
Q

List networks

A

docker network ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Get detailed info of a network

A

docker network inspect network_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create/Delete a network

A

docker network create network_name

docker network rm network_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Delete all unused networks

A

docker network prune

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Add/remove a container to existing network

A

docker network connect network-name container

docker network disconnect network-name container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create network specifying a subnet and gateway of this subnet

A

docker network create –subnet 10.0.1.0/24 –gateway 10.0.1.1 my_net
docker network create –subnet 10.2.0.0/16 –gateway 10.2.0.1 –ip-range=10.2.5.0/24 –driver=bridge –label=host4net br001
docker network inspect br001

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Create container and network, assign container to a network

A
  1. docker container run –name nginx-cont -d nginx
    docker network create my_net
    docker network connect nginx-cont my_net
  2. docker network create –subnet 10.2.0.0/16 –gateway 10.0.0.1 –ip-range=10.2.5.0 –driver=bridge –label=host1net br001
    2.1.
    docker container run –name centos-cont -dit –network br001 centos /bin/bash
    yum -y update
    yum install -y net-tools
    ip addr=> ip will be from ip-range, for example 10.2.5.1
    2.2.
    docker container run –name nginx-cont –ip 10.2.5.100 -d –network br001 nginx
    docker container inspect nginx-cont | grep -i ipaddr
How well did you know this?
1
Not at all
2
3
4
5
Perfectly