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

Cannot create a container with more than one network requested #248

Closed
ikolomiyets opened this issue Sep 23, 2020 · 1 comment
Closed

Cannot create a container with more than one network requested #248

ikolomiyets opened this issue Sep 23, 2020 · 1 comment

Comments

@ikolomiyets
Copy link
Contributor

Describe the bug
Docker Provider fails to create a container when ContainerRequest has more than one network specified.

To Reproduce
Consider container request like the following:
amqpRequest := testcontainers.ContainerRequest{ Image: "nginx", Name: "nginx-test", ExposedPorts: []string{"80/tcp"}, Env: env, AutoRemove: true, WaitingFor: hp, Networks: []string{"network1", "network2"}, }
When executed the response from the docker is "Error response from daemon: Container cannot be connected to network endpoints: network1, network2" (assuming that both networks exist).

Expected behavior
Container created.

** docker info **
output of the command:

$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 8
  Running: 8
  Paused: 0
  Stopped: 0
 Images: 61
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.945GiB
 Name: docker-desktop
 ID: YEZ5:Y3SD:YQ2P:CQST:GSQY:FUVV:ZOB4:OWUC:A65B:4LDT:CCPL:I2C3
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 104
  Goroutines: 99
  System Time: 2020-09-23T18:30:17.3452466Z
  EventsListeners: 3
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  localhost:5000
  172.30.0.0/16
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional context
It appears that Docker does not allow more than one network to be specified during CreateContainer call. Instead, if more than one network specified then CreateContainer should be called with only one network out of the requested list. Then, NetworkConnect should be called for the remaining networks.

ikolomiyets added a commit to ikolomiyets/testcontainers-go that referenced this issue Sep 23, 2020
…ith more than one network specified in the request.
gianarb added a commit that referenced this issue Sep 24, 2020
This was referenced Mar 12, 2021
@mdelapenya
Copy link
Member

I think this was resolved in #249. Closing

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

No branches or pull requests

2 participants