Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose not working with swarm overlay networking in docker v1.12rc #24107

Closed
frisky opened this issue Jun 29, 2016 · 23 comments
Closed

Comments

@frisky
Copy link

frisky commented Jun 29, 2016

Output of docker version:
root@xxxxx:~# docker version
Client:
Version: 1.12.0-rc2
API version: 1.24
Go version: go1.6.2
Git commit: 906eacd
Built: Fri Jun 17 21:09:07 2016
OS/Arch: linux/amd64

Server:
Version: 1.12.0-rc2
API version: 1.24
Go version: go1.6.2
Git commit: 906eacd
Built: Fri Jun 17 21:09:07 2016
OS/Arch: linux/amd64

root@xxxxx:~# docker-compose version
docker-compose version 1.8.0-rc1, build 9bf6bc6
docker-py version: 1.8.1
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

Output of docker info:
Containers: 49
Running: 0
Paused: 0
Stopped: 49
Images: 109
Server Version: 1.12.0-rc2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 246
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge overlay null host
Swarm: active
NodeID: 34lgngb2j2iufvk046th0p6qq
IsManager: Yes
Managers: 1
Nodes: 3
CACertHash: sha256:4dd1a761493f5ef3fcaa783113b85b935a7686cc954f5507af9b3743b87cd5b9
Runtimes: default
Default Runtime: default
Security Options: apparmor seccomp
Kernel Version: 3.16.0-30-generic
Operating System: Ubuntu 14.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.955 GiB
Name: pek2-gosv-16-dhcp226
ID: 2B4M:L4M2:6Q3A:HLAU:3CNJ:JA7I:34T3:NRBA:BGY6:RY5A:4AS3:AC6L
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Http Proxy: xxxx.some.com:1234
Https Proxy: xxxx.some.com:1234
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):

Steps to reproduce the issue:
0. Prepare three ubuntu14.04 machines, here I used VMware VMs

  1. Upgrade docker engine to v1.12rc2
  2. (Optional)Upgrade docker compose 1.8.0-rc1 (I could also reproduce this issue on earlier version such as v1.6.1GA)
  3. create a swarm cluster with 1 manger node and 2 slave nodes, as documented in v1.12 swarm-mode doc. Here in my network setup, "ingress" is swarm created overlay network
    pengzhencao@pek2-gosv-16-dhcp226:/docker/docker$ docker node list
    ID NAME MEMBERSHIP STATUS AVAILABILITY MANAGER STATUS
    34lgngb2j2iufvk046th0p6qq * pek2-gosv-16-dhcp226 Accepted Ready Active Leader
    37fmlm52xw0iy7k6zoo5j09px pek2-gosv-16-dhcp160 Accepted Ready Active
    61lw7iskl9ivnxaveby8dfaf1 pek2-gosv-16-dhcp45 Accepted Ready Active
    pengzhencao@pek2-gosv-16-dhcp226:
    /docker/docker$ docker network list
    NETWORK ID NAME DRIVER SCOPE
    8b94d08c0f67 bridge bridge local
    74b71c054864 deploy_default bridge local
    abd08b2c6c5d docker_gwbridge bridge local
    651d9df026eb host host local
    7oywymoz6bbp ingress overlay swarm
    18e3039be16b none null local
  4. On the swarm manager node, edit docker-compose.yml file with the following settings:
    version: '2'
    services:
    log:
    build: ./log/
    volumes:
    - /var/log/harbor/:/var/log/docker/
    ports:
    - 1514:514
    ....(some other services)
    networks:
    default:
    external:
    name: ingress
  5. run with "docker-compose up"

Describe the results you received:
pengzhencao@pek2-gosv-16-dhcp226:~/harbor/Deploy$ docker-compose up
Recreating deploy_log_1
ERROR: for log swarm-scoped network (ingress) is not compatible with docker create or docker run. This network can be only used docker service
ERROR: Encountered errors while bringing up the project.
Describe the results you expected:
Docker compose should deploy the services up with overlay network "ingress"

Additional information you deem important (e.g. issue happens only occasionally):
I've followed swarm and docker-compose integration guide here:
https://docs.docker.com/compose/networking/

The above error seems to be thrown in L356:
in docker/daemon/container_operations.go
330 func errClusterNetworkOnRun(n string) error {
331 return fmt.Errorf("swarm-scoped network (%s) is not compatible with docker create or docker run. This network can be only used docker service", n)
332 }
333
334 // updateContainerNetworkSettings update the network settings
335 func (daemon _Daemon) updateContainerNetworkSettings(container *container.Container, endpointsConfig map[string]_networktypes.EndpointSetti ngs) error {
336 var (
337 n libnetwork.Network
338 err error
339 )
340
341 mode := container.HostConfig.NetworkMode
342 if container.Config.NetworkDisabled || mode.IsContainer() {
343 return nil
344 }
345
346 networkName := mode.NetworkName()
347 if mode.IsDefault() {
348 networkName = daemon.netController.Config().Daemon.DefaultNetwork
349 }
350 if mode.IsUserDefined() {
351 n, err = daemon.FindNetwork(networkName)
352 if err != nil {
353 return err
354 }
355 if !container.Managed && n.Info().Dynamic() {
356 return errClusterNetworkOnRun(networkName)
357 }
358 networkName = n.Name()
359 }
360

@mustafaakin
Copy link
Contributor

mustafaakin commented Jun 29, 2016

Can confirm:

ubuntu@d01:~$ docker node ls
ID                           NAME  MEMBERSHIP  STATUS  AVAILABILITY  MANAGER STATUS
26555ihr5k0ulrejhqw5ta4fr *  d01   Accepted    Ready   Active        Leader
2oykq6dxcc6kiwuryw9dnz4xg    d03   Accepted    Ready   Active
75eipl0dzuo2o0jmr5fu1t9w8    d02   Accepted    Ready   Active
94iu6j5syl0oy8rn0ti143qrf    d04   Accepted    Ready   Active
ubuntu@d01:~$ docker network inspect ss
[
    {
        "Name": "ss",
        "Id": "dstw8gr2k6jre96loa1xv5hsi",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "257"
        },
        "Labels": null
    }
]
ubuntu@d01:~$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
90f2d1ca7727        bridge              bridge              local
e41b10510079        docker_gwbridge     bridge              local
33ae76150242        host                host                local
6rgftkwx7jme        ingress             overlay             swarm
4d5d46a37ef7        none                null                local
dstw8gr2k6jr        ss                  overlay             swarm
ubuntu@d01:~$ docker run -ti --net=ss alpine ash
docker: Error response from daemon: network ss not found.
See 'docker run --help'.

@sdemura
Copy link

sdemura commented Jun 29, 2016

I reported this with docker run last week. See #23901.

Looks it's working as intended unfortunately. You'll still have to use a 3rd party K/V store for overlay networks.

@dnephin
Copy link
Member

dnephin commented Jun 29, 2016

That's correct, docker-compose doesn't work with swarm mode directly. You have to use the experimental bundles (in compose 1.8):

docker-compose bundle
docker stack deploy

@frisky
Copy link
Author

frisky commented Jun 30, 2016

Thanks @sdemura for your input. And @dnephin "docker-compose bundle" does not work either with same error.

hmm. Will docker-compose be supported with built-in swarm-mode overlay network when v1.12 is GA?
Otherwise it will still be complex to deploy another external K-V store.
If it not possible to make it in v1.12GA, we need to make it clearly in docker-compose doc that user should use traditional swarm cluster rather than built-in swarm-mode for this overlay network scenario.

@thaJeztah
Copy link
Member

I think for now this is a docs issue /cc @sfsmithcha

@michelvocks
Copy link

michelvocks commented Jun 30, 2016

I'm actually confused. I've tried to run the following docker-compose file in my docker 1.12 swarm mode cluster:

version: "2"

services:
  web:
    image: httpd

networks:
  default:
    driver: overlay

But I only get a message: "ERROR: driver name: if driver is specified name is required"
This means it is not supported? Is it intended?

@subcrew
Copy link

subcrew commented Jul 11, 2016

Also confused when create calico network:

$docker --version
Docker version 1.12.0-rc3, build 91e29e8
$docker create network -d calico --ipam-driver calico calico-net
Error response from daemon: rpc error: code=3 desc = invalid driver specfied

Docker 1.12 only support overlay driver now?

@thaJeztah
Copy link
Member

@gwanii looks like that's a different issue; are you sure the calico driver is properly installed? Please open a new issue if it's not working

@leokhoa
Copy link

leokhoa commented Jul 22, 2016

I have the same issue with docker 1.12.0-rc4

docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
e7eaa12b447f        bridge              bridge              local               
78479e7ba7fd        docker_gwbridge     bridge              local               
95ba40be231e        host                host                local               
87rd9a232xcn        ingress             overlay             swarm               
f62bde729f9e        none                null                local               
9mlfodbyuu9f        test                overlay             swarm     
docker-compose up -d
Creating postgres95_rdb_1

ERROR: for rdb  network test not found
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose/cli/main.py", line 63, in main
AttributeError: 'ProjectError' object has no attribute 'msg'
docker-compose returned -1

I hope it will be fixed in Docker 1.12 GA

@thaJeztah
Copy link
Member

@leokhoa that error message is coming from Docker Compose; make sure you're using the latest version (release candidate) of Docker Compose. If that doesn't resolve the issue, please open an issue in the Docker Compose issue tracker, where it should be resolved; http://github.com/docker/compose/issues

@pouicr
Copy link

pouicr commented Aug 2, 2016

Hi,

I'm using docker 1.12.0 GA (and compose 1.8) and experimenting the same problem @michelvocks (ERROR: driver name: if driver is specified name is required).
I tried using only docker command instead:

Overlay network OK:

`
docker@swarm0:~$ docker network create -d overlay mynet
9ka6iflf758sy02oy6awzl80n

docker@swarm0:~$ docker network ls
NETWORK ID NAME DRIVER SCOPE
ccc529215ee8 bridge bridge local
8c23d100a05a docker_gwbridge bridge local
ca26f9b2f452 host host local
dacbe1eqz502 ingress overlay swarm
9ka6iflf758s mynet overlay swarm
e753873c2924 none null local

`

Container based on this network KO:

`
docker@swarm0:~$ docker run -d -p 80:80 --net mynet nginx
docker: Error response from daemon: network mynet not found.
See 'docker run --help'.

`

Am I missing something ?

@al-jeyapal
Copy link

al-jeyapal commented Aug 11, 2016

@pouicr we're having similar issues. So far, from what I can find, it appears that you can only connect to a Docker 1.12 'swarm scoped' overlay network if you use docker service (see
#23901 (comment)). I presume this will work in docker bundle as well, but we're not ready to shift to that yet in Production given its experimental status.

Happy to be corrected. We are trying to shift to using a Docker 1.12 swarm, but our overlay network in the docker-compose.yml file is throwing the same issue experienced by @michelvocks:

"ERROR: driver name: if driver is specified name is required"

For our current concept testing we have had to use a bridge network driver scoped to local. This was done by commenting out the driver in our docker-compose.yml file:

networks:
  test-network:
    #driver: overlay

@pouicr
Copy link

pouicr commented Aug 11, 2016

Thx @al-jeyapal for the feedback.
Waiting 1.13 😄

@sfsmithcha
Copy link
Contributor

Docs issue covered by : cc5debc

@RRAlex
Copy link

RRAlex commented Aug 19, 2016

My understanding is that docker-compose is getting replaced by .dab files for the multi-node use case, which is fine...
The problem is that, at the moment, a lot of features (especially security features like capabilities, etc. but many others docker/compose#3680 (comment) ) are not there yet, even from the docker service CLI.
It's quite visible when you run docker-compose bundle.

So beside scaling a simple service with almost no configuration, I'm curious how people are actually using swarm in production, securely, right now?
And how do you do it without typing commands by hand?

Maybe our use case is too complex, though it doesn't seem like it, but hopefully every arguments supported by run that were available in compose will be in the .dab by 1.13, otherwise it's going to be a long wait... Cheers!

@schmunk42
Copy link
Contributor

@dnephin In which docker version is docker stack deploy available (client, server, swarm...)? Do I need an experimental build?

@thaJeztah
Copy link
Member

@schmunk42 it's in docker 1.12.x with experimental features enabled

@schmunk42
Copy link
Contributor

@thaJeztah Thank you, I installed an experimental client and found the deploy command. Do I need experimental builds also for the engine?

@thaJeztah
Copy link
Member

@schmunk42 I think it's currently client-side only (https://github.com/docker/docker/blob/e8b9f38c7e2e249084c78c81f136c6d22432af6f/cli/command/stack/deploy.go#L48-L69)

@brikeyes
Copy link

@al-jeyapal
networks:
test-network:
#driver: overlay

this worked for me !!!!!! thanks

@cdstelly
Copy link

Version 1.12.6

If I want to create a docker-compose network with 'overlay' driver, I get

ERROR: driver name: if driver is specified name is required

If I force it to 'bridge', no error.

If I create the network separately, it works fine.

@fabio-barile
Copy link

same issue with version 1.13

@thaJeztah
Copy link
Member

@fabio-barile that should be fixed in docker 1.13.1, see #28528, and fixed by #29826

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

No branches or pull requests