docker 网络
最后发布时间 : 2024-02-23 15:49:39
浏览量 :
创建网络
docker network create springcloud
查看网络
docker network ls
指定网络
docker run --rm -it --network=springcloud test bash
networks:
springcloud:
external: true
networks:
my-network:
external:
name: springcloud
version: '3'
services:
myapp:
image: my-image
networks:
- springcloud
networks:
springcloud:
driver: bridge
指定hostname
docker run --rm -it --network=springcloud --hostname=node1 test bash
docker run --rm -it --network=springcloud --hostname=node2 test bash
网络工具
sudo apt install iputils-ping