sudo docker run --detach --name my_nginx --publish 8080:80 nginx
65ee11c24f3d835d0a53e301fbc82353e5a53db0894a45b38cc151947b890ed8
sudo docker network create nginx_network
571f85facc96691365d2cddf7fbf8d57b5bdff1d243ed5ddd483351a46d81067
sudo docker network connect nginx_network my_nginx
sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
58866427dd61 bridge bridge local
f588c89e342e host host local
571f85facc96 nginx_network bridge local
40e61f80d7dd none null local
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
65ee11c24f3d nginx "/docker-entrypoint.…" 34 seconds ago Up 33 seconds 0.0.0.0:8080->80/tcp, :::8080->80/tcp my_nginx
sudo docker container inspect my_nginx
<...>
"nginx_network": {
"IPAMConfig": {},
"Links": null,
"Aliases": [
"65ee11c24f3d"
],
"NetworkID": "571f85facc96691365d2cddf7fbf8d57b5bdff1d243ed5ddd483351a46d81067",
"EndpointID": "1d4a2cbc9aeabf6601b34c12128e238ebcf0d767b06c2c6bcdacdfe8644c0442",
"Gateway": "172.21.0.1",
"IPAddress": "172.21.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:15:00:02",
"DriverOpts": {}
<...>
sudo docker container inspect my_nginx | grep nginx_network
"nginx_network": {
sudo docker network disconnect nginx_network my_nginx
sudo docker network rm 571f85facc96
571f85facc96
sudo docker rmi nginx --force
Untagged: nginx:latest
Untagged: nginx@sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514
No comments:
Post a Comment