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

Using network_mode: 'host' with docker compose up results in error, works in docker-compose #1619

Closed
dmateusp opened this issue Apr 30, 2021 · 5 comments

Comments

@dmateusp
Copy link

Description

Specifying network_mode fails with:

Error response from daemon: network-scoped alias is supported only for containers in user defined networks

Steps to reproduce the issue:

  1. Create a docker-compose specification that includes a network_mode: ...

e.g.

version: '3.9'
services:
    postgres:
        image: postgres:13-alpine
        network_mode: 'host'
  1. Run docker compose up

Describe the results you received:

Error response from daemon: network-scoped alias is supported only for containers in user defined networks

Describe the results you expected:

The containers are created, in the same way as docker-compose. My docker-compose version is

❯ docker-compose --version
docker-compose version 1.29.1, build unknown

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

Output of docker version:

❯ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker context show:
You can also run docker context inspect context-name to give us more details but don't forget to remove sensitive content.

❯ docker context inspect default
[
    {
        "Name": "default",
        "Metadata": {
            "StackOrchestrator": "swarm"
        },
        "Endpoints": {
            "docker": {
                "Host": "unix:///var/run/docker.sock",
                "SkipTLSVerify": false
            },
            "kubernetes": {
                "Host": "<redacted>",
                "SkipTLSVerify": false,
                "DefaultNamespace": "<redacted>",
                "AuthProvider": {
                    "name": "gcp",
                    "config": {
                        <redacted>
                    }
                }
            }
        },
        "TLSMaterial": {
            "kubernetes": [
                "ca.pem"
            ]
        },
        "Storage": {
            "MetadataPath": "\u003cIN MEMORY\u003e",
            "TLSPath": "\u003cIN MEMORY\u003e"
        }
    }
]

Output of docker info:

❯ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.6.0)

Server:
 Containers: 10
  Running: 0
  Paused: 0
  Stopped: 10
 Images: 11
 Server Version: 20.10.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 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: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.25-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 4.576GiB
 Name: docker-desktop
 ID: UY5O:MSVB:PVB5:UMUH:WFUH:4FPS:Y3U2:TLQM:PL54:EDWI:GZLU:AO6Q
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 55
  Goroutines: 103
  System Time: 2021-04-30T12:14:24.1883Z
  EventsListeners: 4
 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.):

Running those commands locally

@ndeloof
Copy link
Collaborator

ndeloof commented May 2, 2021

This has been fixed already by #1541
fix is available with Cloud integration 1.0.14

@ndeloof ndeloof closed this as completed May 2, 2021
@dmateusp
Copy link
Author

dmateusp commented May 2, 2021

ah thanks @ndeloof and sorry for the duplicate issue, I think I'm on the latest version of docker for desktop so I imagine I just need to wait for it to be released on it

@SayakMukhopadhyay
Copy link

Is this still not deployed in Docker Windows?

@mat007
Copy link
Contributor

mat007 commented Dec 13, 2021

I’m not sure in which Docker Desktop version it was first released, but the latest one definitely has it.

@chugunovyar
Copy link

`Client: Docker Engine - Community
Version: 24.0.6
API version: 1.43
Go version: go1.20.7
Git commit: ed223bc
Built: Mon Sep 4 12:31:44 2023
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 24.0.6
API version: 1.43 (minimum version 1.12)
Go version: go1.20.7
Git commit: 1a79695
Built: Mon Sep 4 12:31:44 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.22
GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca
runc:
Version: 1.1.8
GitCommit: v1.1.8-0-g82f18fe
docker-init:
Version: 0.19.0
GitCommit: de40ad0
`

Still happens

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants