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

Static IP not in generated compose file #24

Open
EtherealMochi opened this issue Aug 11, 2021 · 7 comments
Open

Static IP not in generated compose file #24

EtherealMochi opened this issue Aug 11, 2021 · 7 comments

Comments

@EtherealMochi
Copy link

Hello I have some static IPs set for various containers and for some reason it isn't saving those fields.

@Red5d
Copy link
Owner

Red5d commented Oct 19, 2021

Can you provide the output of "docker inspect <container_id>" for one of your containers that this is happening with?

@typoworx-de
Copy link

Here's a dump of one of my containers. Would be awesome to have this feature included, as I'm trying to build-up a docker backup-solution basing on your great work ;-)

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "514f598fe242aa683d1cbd37139c8eed620577f96d654c12ac47dd918bdd2ebd",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": null,
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/514f598fe242",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "bridge-172.30.0.1": {
                    "IPAMConfig": {
                        "IPv4Address": "172.30.0.2"
                    },
                    "Links": null,
                    "Aliases": [
                        "d4d0b7504d60",
                        "mysql.docker.local"
                    ],
                    "NetworkID": "76338743f589ebc2d87c671570efbbd91321b5eee95b1143ac4e7e5cdac44624",
                    "EndpointID": "c85389f8110487bc9c3a9d0cc5f0a38e63dfff803173ee5a24e6440cdf9c533b",
                    "Gateway": "172.30.0.1",
                    "IPAddress": "172.30.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:1e:00:02",
                    "DriverOpts": null
                }
            }
        }
`

@aauerswald
Copy link

aauerswald commented Feb 22, 2022

Hello,

I have the same issue. I dont see any IP in the export.

networks:
- mac0
ports:
- 80:3001/tcp
restart: always
stdin_open: true
tty: true
volumes:
- uptime_data:/app/data
- uptime_certs:/certs
working_dir: /app
networks:
mac0:
external: true

That is the docker inspect output for that container.

"NetworkSettings": {
"Bridge": "",
"SandboxID": "1b0693985b8174b81fa5f1db7dc42632432963b961fdbe62b551d4b1077633f2",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/1b0693985b81",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"mac0": {
"IPAMConfig": {
"IPv4Address": "192.168.178.196"
},
"Links": null,
"Aliases": [
"1c6893bb97b8",
"8a12d2a96451",
"ea0d6eb92cea",
"272826446e11"
],
"NetworkID": "111e0b748d2458c81845f60eda9f8a7297b8ce26bf92a8ab94134bfd7e073c4a",
"EndpointID": "f073811b2e1f67b2882e003dc0733319af291e698a2650ed6a8ae7851ab65fc9",
"Gateway": "192.168.178.1",
"IPAddress": "192.168.178.196",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:c0:a8:b2:c4",
"DriverOpts": null
}
}
}

@Red5d
Copy link
Owner

Red5d commented Apr 9, 2022

@EtherealMochi @aauerswald @typoworx-de Are you still experiencing this issue? A few updates have been merged since February.

@kroese
Copy link

kroese commented Apr 23, 2023

@Red5d I'm still experiencing this issue, even with the latest release.

Repository owner deleted a comment Dec 26, 2023
@dmrowe
Copy link

dmrowe commented Dec 27, 2023

I am also looking for this feature, as I have ipvlan containers that have custom IPv4 addresses set.

Here's an example. docker-autocompose

docker inspect a8774c000c40
[
    {
        "Id": "a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807",
        "Created": "2023-12-26T21:09:31.347258631Z",
        "Path": "/opt/adguardhome/AdGuardHome",
        "Args": [
            "--no-check-update",
            "-c",
            "/opt/adguardhome/conf/AdGuardHome.yaml",
            "-w",
            "/opt/adguardhome/work"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 30558,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-12-26T21:09:33.367176068Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:d539fe0e4ff110ac9f961888634816f1fa5d3fb67a0eef934f7511b56adc332a",
        "ResolvConfPath": "/var/lib/docker/containers/a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807/hostname",
        "HostsPath": "/var/lib/docker/containers/a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807/hosts",
        "LogPath": "/var/lib/docker/containers/a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807/a8774c000c40964a3a129996d393dda7a69b9058fbdbac8eff43a078bc533807-json.log",
        "Name": "/AdGuard-Home",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/mnt/user/appdata/adguard_home/config:/opt/adguardhome/conf:rw",
                "/mnt/user/appdata/adguard_home/workingdir:/opt/adguardhome/work:rw"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-file": "1",
                    "max-size": "500m"
                }
            },
            "NetworkMode": "br0",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/9e6dd24f9fe97b32303495cb1d0481c8cd063a46d30beb155f0902f7f0e471e6-init/diff:/var/lib/docker/overlay2/0100881c9454e9a0635579765e17e76fe766c87ce58649268a5860bae651d5c4/diff:/var/lib/docker/overlay2/4ea49b3cc87c055d045ae32a0c84cf406bd2ba4935bbcd96cc33dde48475b53a/diff:/var/lib/docker/overlay2/b72d093ff80c426dc01bbff3fe10b70986c4da602324ab717e7f7380795543ab/diff:/var/lib/docker/overlay2/a08075e18aeed2a9604dc3976ae809cf1083c98013fdd8395b83dff8ad2d5772/diff:/var/lib/docker/overlay2/340699bb7eabfa9de42b5bfb9d82549142e00129e517011c5efe3de1a50ccc80/diff",
                "MergedDir": "/var/lib/docker/overlay2/9e6dd24f9fe97b32303495cb1d0481c8cd063a46d30beb155f0902f7f0e471e6/merged",
                "UpperDir": "/var/lib/docker/overlay2/9e6dd24f9fe97b32303495cb1d0481c8cd063a46d30beb155f0902f7f0e471e6/diff",
                "WorkDir": "/var/lib/docker/overlay2/9e6dd24f9fe97b32303495cb1d0481c8cd063a46d30beb155f0902f7f0e471e6/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/mnt/user/appdata/adguard_home/config",
                "Destination": "/opt/adguardhome/conf",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/mnt/user/appdata/adguard_home/workingdir",
                "Destination": "/opt/adguardhome/work",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "a8774c000c40",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3000/tcp": {},
                "3000/udp": {},
                "443/tcp": {},
                "443/udp": {},
                "53/tcp": {},
                "53/udp": {},
                "5443/tcp": {},
                "5443/udp": {},
                "6060/tcp": {},
                "67/udp": {},
                "68/udp": {},
                "80/tcp": {},
                "853/tcp": {},
                "853/udp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "TZ=Australia/Sydney",
                "HOST_OS=Unraid",
                "HOST_HOSTNAME=herakles",
                "HOST_CONTAINERNAME=AdGuard-Home",
                "TCP_PORT_3000=3000",
                "TCP_PORT_53=53",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "--no-check-update",
                "-c",
                "/opt/adguardhome/conf/AdGuardHome.yaml",
                "-w",
                "/opt/adguardhome/work"
            ],
            "Image": "adguard/adguardhome:latest",
            "Volumes": null,
            "WorkingDir": "/opt/adguardhome/work",
            "Entrypoint": [
                "/opt/adguardhome/AdGuardHome"
            ],
            "OnBuild": null,
            "Labels": {
                "maintainer": "AdGuard Team <[email protected]>",
                "net.unraid.docker.icon": "https://raw.githubusercontent.com/SiwatINC/unraid-ca-repository/master/icons/adguard.png",
                "net.unraid.docker.managed": "dockerman",
                "net.unraid.docker.webui": "http://[IP]/",
                "org.opencontainers.image.authors": "AdGuard Team <[email protected]>",
                "org.opencontainers.image.created": "2023-12-11T14:15:09Z",
                "org.opencontainers.image.description": "Network-wide ads & trackers blocking DNS server",
                "org.opencontainers.image.documentation": "https://github.com/AdguardTeam/AdGuardHome/wiki/",
                "org.opencontainers.image.licenses": "GPL-3.0",
                "org.opencontainers.image.revision": "f6ad64bf692430b62a83bc715b5d5795d5182098",
                "org.opencontainers.image.source": "https://github.com/AdguardTeam/AdGuardHome",
                "org.opencontainers.image.title": "AdGuard Home",
                "org.opencontainers.image.url": "https://adguard.com/en/adguard-home/overview.html",
                "org.opencontainers.image.vendor": "AdGuard",
                "org.opencontainers.image.version": "v0.107.43"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "1426a614f6b4f84306ff26f02fc1fe3e243671505097d1e3da0fd699490da9d3",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/1426a614f6b4",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "br0": {
                    "IPAMConfig": {
                        "IPv4Address": "192.168.0.170"
                    },
                    "Links": null,
                    "Aliases": [
                        "a8774c000c40"
                    ],
                    "NetworkID": "49514955e35e643e3add8d81da0c496f523f64cbc82d80b7c0984aa354359c28",
                    "EndpointID": "0885db824b67120031936f01be99456be6eff517212c2763d9f139eefd579e3b",
                    "Gateway": "192.168.0.1",
                    "IPAddress": "192.168.0.170",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

Here's what docker-autocompose provides for this container:

networks:
  br0:
    external: true
    name: "br0"

services:
  AdGuard-Home:

    command:
      - "--no-check-update"
      - "-c"
      - "/opt/adguardhome/conf/AdGuardHome.yaml"
      - "-w"
      - "/opt/adguardhome/work"

    container_name: "AdGuard-Home"

    entrypoint:
      - "/opt/adguardhome/AdGuardHome"

    environment:
      - "TZ=Australia/Sydney"
      - "HOST_OS=Unraid"
      - "HOST_HOSTNAME=herakles"
      - "HOST_CONTAINERNAME=AdGuard-Home"
      - "TCP_PORT_3000=3000"
      - "TCP_PORT_53=53"
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

    expose:
      - "3000/tcp"
      - "3000/udp"
      - "443/tcp"
      - "443/udp"
      - "53/tcp"
      - "53/udp"
      - "5443/tcp"
      - "5443/udp"
      - "6060/tcp"
      - "67/udp"
      - "68/udp"
      - "80/tcp"
      - "853/tcp"
      - "853/udp"

    hostname: "a8774c000c40"

    image: "adguard/adguardhome:latest"

    ipc: "private"

    labels:
      maintainer: "AdGuard Team <[email protected]>"
      net.unraid.docker.icon: "https://raw.githubusercontent.com/SiwatINC/unraid-ca-repository/master/icons/adguard.png"
      net.unraid.docker.managed: "dockerman"
      net.unraid.docker.webui: "http://[IP]/"
      org.opencontainers.image.authors: "AdGuard Team <[email protected]>"
      org.opencontainers.image.created: "2023-12-11T14:15:09Z"
      org.opencontainers.image.description: "Network-wide ads & trackers blocking DNS server"
      org.opencontainers.image.documentation: "https://github.com/AdguardTeam/AdGuardHome/wiki/"
      org.opencontainers.image.licenses: "GPL-3.0"
      org.opencontainers.image.revision: "f6ad64bf692430b62a83bc715b5d5795d5182098"
      org.opencontainers.image.source: "https://github.com/AdguardTeam/AdGuardHome"
      org.opencontainers.image.title: "AdGuard Home"
      org.opencontainers.image.url: "https://adguard.com/en/adguard-home/overview.html"
      org.opencontainers.image.vendor: "AdGuard"
      org.opencontainers.image.version: "v0.107.43"

    logging:
      driver: "json-file"
      options:
        max-file: "1"
        max-size: "500m"

    networks:
      - "br0"

    volumes:
      - "/mnt/user/appdata/adguard_home/config:/opt/adguardhome/conf"
      - "/mnt/user/appdata/adguard_home/workingdir:/opt/adguardhome/work"

    working_dir: "/opt/adguardhome/work"

version: "3.6"

@yuusou
Copy link

yuusou commented Jan 31, 2024

Hi, sorry to resurrect this.

I've built this (and a few other changes, including podman support) into my fork.
I don't run docker, only podman, so some testing would be helpful.

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

10 participants
@typoworx-de @Red5d @kroese @yuusou @aauerswald @dmrowe @EtherealMochi and others