Network local-docker-net Created となる事を確認。fake containerのエラーは無視でOKです
1 2 3 4 5 6
$ docker compose --project-directory ./local-docker-network/ up [+] Running 2/2 ✔ Network local-docker-net Created 0.0s ✔ Container local-docker-network-fake-1 Created 0.1s Attaching to fake-1 Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "fake": executable file not found in $PATH: unknown
作成されたネットワークの確認
1 2
$ docker network ls | grep local-docker-net f10011d3d58b local-docker-net bridge local
疎通確認用の一時コンテナ作成 project-{1,2}
1 2 3 4 5
# project-1 $ docker compose --project-directory ./project-1/ up -d
# project-2 $ docker compose --project-directory ./project-2/ up -d
1 2 3 4
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5840b69e6824 nginx:latest "/docker-entrypoint.…" 10 seconds ago Up 9 seconds 80/tcp project-2-web_2-1 221f0071bdfe nginx:latest "/docker-entrypoint.…" 25 seconds ago Up 13 seconds 80/tcp project-1-web_1-1