[BUG] docker_network.present recreates the network every time it is run
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
I have docker_network.present state which recreates the Docker network every time it is run, despite nothing really changing.
Setup
Please be as specific as possible and give set-up details.
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
- classic packaging
- onedir packaging
- used bootstrap to install
Steps to Reproduce the behavior
I have Docker installed on target server:
dpkg -l | grep docker on target server:
docker.io 24.0.5-0ubuntu1~22.04.1
python3-docker 5.0.3-1
lsb_release -a on target server:
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
I have IPv6 enabled for Docker, /etc/docker/daemon.json:
{
"experimental": true,
"userland-proxy": false,
"ip6tables": true,
"ipv6": true,
"default-address-pools": [
{ "base": "172.17.0.0/16", "size": 16 },
{ "base": "172.18.0.0/16", "size": 16 },
{ "base": "172.19.0.0/16", "size": 16 },
{ "base": "172.20.0.0/14", "size": 16 },
{ "base": "172.24.0.0/14", "size": 16 },
{ "base": "172.28.0.0/14", "size": 16 },
{ "base": "fd00:2::/104", "size": 112 }
],
"fixed-cidr-v6": "fd00:1::/64"
}
I use the following state:
mynet_network:
docker_network.present:
- name: mynet
- ipv6: True
pip freeze | grep salt:
salt==3007.0
I use salt-ssh to deploy to the server. After each run, it always reports something like:
ID: mynet_network
Function: docker_network.present
Name: mynet
Result: True
Comment: Network 'mynet' was replaced with updated config
Started: 03:01:56.091744
Duration: 1638.737 ms
Changes:
----------
mynet:
----------
IPAM:
----------
Config:
----------
new:
old:
|_
----------
Gateway:
172.18.0.1
Subnet:
172.18.0.0/16
|_
----------
Gateway:
fd00:2::1/112
Subnet:
fd00:2::/112
reconnected:
- mycontainer
recreated:
True
A good thing is that:
- It uses same IPs when recreating.
- The containers which depend on this network are not recreated (e.g.,
mycontainer).
Expected behavior
The network it not recreated.
Versions Report
salt --versions-report
Salt Version:
Salt: 3007.0
Python Version:
Python: 3.8.10 (default, Nov 22 2023, 10:22:35)
Dependency Versions:
cffi: 1.16.0
cherrypy: unknown
dateutil: 2.9.0.post0
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.3
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.8
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.0
pycparser: 2.22
pycrypto: Not Installed
pycryptodome: 3.20.0
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 26.0.0
relenv: Not Installed
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.4
ZMQ: 4.3.5
Salt Package Information:
Package Type: Not Installed
System Versions:
dist: ubuntu 20.04.6 focal
locale: utf-8
machine: x86_64
release: 5.15.0-101-generic
system: Linux
version: Ubuntu 20.04.6 focal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the docker_network.present state entry point and reproduce the report with the supplied mynet state, IPv6 settings, and salt-ssh setup. Compare the network configuration observed across consecutive runs; done means the existing network is left unchanged and the second run reports no replacement or recreation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100