Skip to content

Commit

Permalink
Properly specify external network in Docker compose
Browse files Browse the repository at this point in the history
Pre-existing networks (defined elsewhere) are
marked as `external` in `docker-compose.yml`.

Instead of using `external` as a separate-line key:
```yml
networks:
  service:
    external:
      name: hpcservice_service
```
we should define network by its name and specify
its externality by using `external: true`:
```yml
networks:
  service:
    name: hpcservice_service
    external: true
```

Official docs:
https://docs.docker.com/compose/networking/#use-a-pre-existing-network

By correctly specifying `external` property, we get
rid of warning "network service: network.external.name
is deprecated in favor of network.name". Useful link:
docker-archive/compose-cli#1856 (comment)
  • Loading branch information
Pl217 committed Oct 21, 2022
1 parent 03db130 commit 4cc57f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker-compose.integrated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ services:
- api.hpc.vm
networks:
service:
external:
name: hpcservice_service
name: hpcservice_service
external: true

0 comments on commit 4cc57f7

Please sign in to comment.