> docker container exec -it my-ubuntu-2 bash
root@09cf2edc3788:/# curl http://my-nginx-2
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
// レスポンスした結果が出力されているため、通信できている。
root@09cf2edc3788:/# curl http://my-nginx-1
curl: (6) Could not resolve host: my-nginx-1
// my-nginx-1はmy-net内に存在しないコンテナのため、通信することができない。
> docker network rm my-net
Error response from daemon: error while removing network: network my-net id f8102650a7624b97eff2a2d8773e5c74d1b0018a9806003848ba0b6cedba14d7 has active endpoints
// my-netに属しているコンテナが起動しているため、削除することができない。
> docker container rm -f my-nginx-2
my-nginx-2
> docker container rm -f my-ubuntu-2
my-ubuntu-2
> docker network rm my-net
my-net
// my-netに属しているコンテナを削除し、再度ネットワークを削除した。