Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

"network default: network.external.name is deprecated in favor of network.name" #1856

Closed
rfay opened this issue Jun 28, 2021 · 11 comments
Closed
Labels
question ❓ Further information is requested

Comments

@rfay
Copy link
Contributor

rfay commented Jun 28, 2021

Description

In compose v2 I always see

"network default: network.external.name is deprecated in favor of network.name"

For every docker-compose command.

Here's the networks stanza:

networks:
  default:
    name: ddev_default
    external: true

This appears to be the exact same as is suggested in the official docs at https://docs.docker.com/compose/networking/#use-a-pre-existing-network - nothing about deprecation there.

And I also don't see network.external.name being used here. It's network.external as a bool, right?

Steps to reproduce the issue:

Use the network stanza above.

Describe the results you received:

"network default: network.external.name is deprecated in favor of network.name"

Describe the results you expected:

No deprecation complaint. Or at least one that I can understand.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:23 2021
 OS/Arch:           darwin/arm64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:55:36 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker context show:

desktop-linux

Output of docker info:

Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0-beta.4)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 10
  Running: 5
  Paused: 0
  Stopped: 5
 Images: 174
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.25-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 5.8GiB
 Name: docker-desktop
 ID: 53UE:EPJ4:JJNQ:JFFR:DIZ4:RKDH:DZOT:O2RE:53SK:6Z4G:7A7B:NPHD
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false


Additional environment details (AWS ECS, Azure ACI, local, etc.):

This is Docker Desktop 3.5.1 on either macOS or Windows.

$ docker-compose --version
Docker Compose version 2.0.0-beta.4
@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

I was not able to reproduce this issue

tested with:

services:
  test:
    image: nginx
networks:
  default:
    name: ddev_default
    external: true
$ docker-compose compose up
[+] Running 1/1
 ⠿ Container truc_test_1  Started                                                                                             2.0s
Attaching to test_1
test_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
...

Can you please prepare a minimal reproduction example?

@ndeloof ndeloof added pending 😶 awaiting some extra data bug 🐞 App is not working correctly. labels Jun 29, 2021
@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

for your information, at some point compose file syntax we defined as:

networks:
  default:
    external: 
      name: ddev_default
      external: true

This was error prone and has been redesign to let user adopt the current syntax, passing external: true. This deprecation notice is here for this specific scenario, but should not be triggered if you don't use this legacy syntax

I notice you use ddev, do you directly run docker-compose with your own compose file, or the one managed by ddev under the hood?

@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

see https://github.com/drud/ddev/blob/master/pkg/ddevapp/templates.go#L190-L193

please report issue to ddev maintainers

@ndeloof ndeloof added wontfix 🚫 This will not be worked on question ❓ Further information is requested and removed pending 😶 awaiting some extra data wontfix 🚫 This will not be worked on bug 🐞 App is not working correctly. labels Jun 29, 2021
@ndeloof ndeloof closed this as completed Jun 29, 2021
@rfay
Copy link
Contributor Author

rfay commented Jun 29, 2021

I am the maintainer of ddev, trying to get it to work with new compose v2 :)

I'm sorry, I'm still missing the point I guess. The docs clearly show the syntax ddev is using here, don't they? https://docs.docker.com/compose/networking/#use-a-pre-existing-network

Am I just blind and I can't see the difference? Can you propose the correct format?

You can recreate this just by using ddev with compose v2:

mkdir junk
ddev config --auto
ddev start

@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

I am the maintainer of ddev, trying to get it to work with new compose v2 :)

Oh, nice.
Ping me on docker community slack if you need a hand

reference syntax:

networks:
  default:
    external: true
    name: my-pre-existing-network

ddev template:

networks:
  default:
    external:
      name: ddev_default

shoud be:

networks:
  default:
    name: ddev_default
    external: true

Makes me wonder: as ddev is written in Go, maybe you could use compose-go to build the model and marshall into yaml?

@rfay
Copy link
Contributor Author

rfay commented Jun 29, 2021

What is compose-go? Would love to know more.

Here's the fix for ddev, ddev/ddev#3076

The reason I couldn't see it is that ddev uses docker-compose config to parse all the files together to use them as a single file. And of course there it was all fixed with the correct syntax. compose was complaining on reading but fixing on writing, and I was studying the output format, which had been normalized.

@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

@ndeloof
Copy link
Collaborator

ndeloof commented Jun 29, 2021

you could do something similar to https://github.com/docker/compose-cli/blob/32fccdda30afa45cd6aab8641ed838a5549573ea/cmd/compose/compose.go#L157-L185 if you don't want to rely on config command to parse and merge compose files

@Mugane
Copy link

Mugane commented Apr 7, 2022

Ugh. What is the correct syntax??

@Wilkolicious
Copy link

The docs still look incorrect.
For reference at time of this comment:

networks:
  default:
    external:
      name: my-pre-existing-network

Correct syntax:

networks:
  default:
    name: my-pre-existing-network
    external: true

or

networks:
  my-pre-existing-network:
    external: true

@lyndseypadget
Copy link

I agree with others. The documentation needs to be updated to reflect the correct syntax. Please either reopen this issue or create a new one for that purpose.

Pl217 added a commit to UN-OCHA/hpc-api that referenced this issue Oct 21, 2022
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)
EHJ-52n added a commit to 52North/data-transloader that referenced this issue Feb 15, 2023
autermann added a commit to 52North/data-transloader that referenced this issue Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question ❓ Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants