for-linux icon indicating copy to clipboard operation
for-linux copied to clipboard

`docker run --ip` no longer works / unable to assign static IP address to container

Open celesteking opened this issue 3 years ago • 1 comments

  • [x] This is a bug report
  • [ ] This is a feature request
  • [ ] I searched existing issues before opening this one

Expected behavior

--ip option stopped working some time ago. It's just ignored currently, it picks up next available IP from network pool instead of using the one I'm passing. I'm sure it used to work just fine. I'm using "bridge" network.

The funny part is that --mac-address is working totally fine. This is driving me insane.

Steps to reproduce the behavior

Output of docker version:

Client:
 Version:           20.10.9
 API version:       1.41
 Go version:        go1.17.5
 Git commit:        c2ea9bc90b
 Built:             Sun Jan  2 15:24:48 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.9
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.5
  Git commit:       79ea9d3080
  Built:            Mon Jan  3 21:43:27 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        52b36a2dd837e8462de8e01458bf02cf9eea47dd
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad007797e0dcd8b7126f27bb87401d224240

Output of docker info:

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 25
  Running: 4
  Paused: 0
  Stopped: 21
 Images: 149
 Server Version: 20.10.9
 Storage Driver: zfs
  Zpool: essd
  Zpool Health: ONLINE
  Parent Dataset: essd/docker
  Space Used By Parent: 66828193792
  Space Available: 19071152128
  Parent Quota: 85899345920
  Compression: off
 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: error
  NodeID: 
  Error: error while loading TLS certificate in /var/lib/docker/swarm/certificates/swarm-node.crt: certificate (1 - 8l8jlwojivqq7x3t6dyc2c1z9) not valid after Sun, 24 Jun 2018 10:46:00 UTC, and it is currently Tue, 04 Jan 2022 16:15:21 MSK: x509: certificate has expired or is not yet valid: 
  Is Manager: false
  Node Address: xxx
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 5b46e404f6b9f661a205e28d59c982d3634148f8
 runc version: 52b36a2dd837e8462de8e01458bf02cf9eea47dd
 init version: de40ad007797e0dcd8b7126f27bb87401d224240
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.14.260-gentoo-core2-x86_64
 Operating System: Gentoo/Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 12.34GiB
 Name: xx
 ID: B6WY:QLR4:5GNO:OYCY:AQXG:5VMO:KX6S:ODMR:WDTU:WHND:V5AL:AQND
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: foodock
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

celesteking avatar Feb 01 '22 21:02 celesteking

Seems to work if you create a custom network ($ docker network create ...) and then $ docker run --net=<my custom network> --ip=....

For the bridge network Docker just seems to ignore the --ip parameter. Not ideal.

joonas-fi avatar Sep 13 '23 10:09 joonas-fi