Chinaunix首页 | 论坛 | 博客
  • 博客访问: 482072
  • 博文数量: 28
  • 博客积分: 858
  • 博客等级: 一等列兵
  • 技术积分: 852
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-02 14:13
文章分类

全部博文(28)

文章存档

2020年(1)

2019年(1)

2018年(5)

2017年(1)

2014年(1)

2013年(2)

2012年(17)

分类: 虚拟化

2018-03-21 15:33:31

Docker native network(What,How,Why)
None
Description: Disable network
  1. How to use none network?
[root@localhost ~]# docker run --rm \
-dit --network none \
--name no-net-alpine \
alpine:latest \
ash
Explanation: run a command in a new container
parameters:
--rm: when the container exited, delete the container.
-d: run in dettach mode, run the container in background.
-i: keep STDIN open even it is not attached.
-t: Allocate a pseudo-TTY
--name: assign a name to the container
Chcker Images:
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 3fd9065eaf02 2 months ago 4.14MB
Check Container:
[root@localhost ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c199c40cac34 alpine:latest "ash" 15 minutes ago Up 15 minutes no-net-alpine
Check the network settings
docker inspect c199c40cac34
"Networks": {
"none": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "f80e6afec2c4e555bc11974ca3996780b8caaf00eed2551b4a89e0a461491d09",
"EndpointID": "16613fd17a4675b0bbe4042d6f27ca052d4b233e3c506cb3a454852b5a8921fc",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
Check the link status in container
[root@localhost ~]# docker exec no-net-alpine ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Check the route in container
[root@localhost ~]# docker exec no-net-alpine ip route
#it will show nothing, no route info for this container.
2. Usage of None network
Some application with analysis data, generate report and other batch tasks.
阅读(3983) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~