Skip to content

도커 네트워크 연동 (2026-01-02) #34

@creepereye1204

Description

@creepereye1204

📌 GitHub Issue 정리

### 제목
[DOCS] Docker Compose ↔ Swarm 네트워크 통신 문제 해결

### 🐞 문제 상황
haproxy-nginx를 Docker Compose로 띄우고,
ecommerce 서비스를 Docker Swarm으로 배포했을 때
서로 네트워크 통신이 원활하지 않음.

Swarm에서만 작동하는 overlay 네트워크는 기본적으로
Swarm 서비스 전용이라 Compose 컨테이너가 붙을 수 없음.

### 🔄 원인
- Swarm overlay 네트워크는 기본적으로 `Attachable: false`
- Compose 컨테이너(Nginx)가 Swarm 네트워크에 직접 attach 불가
- `external: true`로 선언했지만 네트워크가 attachable이 아니어서 실패

### ✅ 해결 방법
1. Swarm overlay 네트워크를 attachable 옵션으로 미리 생성
   ```bash
   docker network create --driver overlay --attachable ecommerce
  1. 각 yml 파일에서 external 네트워크로 지정
    networks:
      ecommerce:
        external: true
  2. Swarm 서비스(Spring Boot)와 Compose 컨테이너(Nginx)를
    동일한 ecommerce 네트워크에 붙임

⚙️ 환경 정보

  • Docker Engine: 24.x
  • Swarm 모드 활성화
  • Compose v2.x
  • OS: Ubuntu 22.04

📸 참고 로그

  • Error response from daemon: Could not attach to network ecommerce: rpc error: code = PermissionDenied desc = network ecommerce not manually attachabl
  • docker network inspect ecommerce | grep Attachable"Attachable": true 확인 후 정상 동작

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions