SaaShup / netbox-docker-plugin

Netbox Docker Plugin
https://saashup.com
BSD 3-Clause "New" or "Revised" License
64 stars 5 forks source link

Containers / Add possibility to extend run command #146

Closed ThaseG closed 3 months ago

ThaseG commented 4 months ago
Netbox version Plugin Version Agent version Docker API Version
v3.6.9 vxx 0.29.4-0 1.45

Actual Behavior

When creating container, I cannot add additional specific commands that can help me give container rights to run openvpn and utilize tunnel interface. Currently it is just doing "docker run -d --name -p -v

Desired Behavior

What is needed ? Additional possibility in docker container GUI, that will support this option : docker run --cap-add=NET_ADMIN --device=/dev/net/tun -d --name -v -p

ThaseG commented 4 months ago

root@ip-10-71-0-70:~# docker inspect openvpn5 [ { "Id": "5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431", "Created": "2024-07-17T08:32:00.862844272Z", "Path": "/home/openvpn/reload-config.sh", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 1672, "ExitCode": 0, "Error": "", "StartedAt": "2024-07-19T08:13:20.362954557Z", "FinishedAt": "2024-07-17T14:09:10.237949147Z" }, "Image": "sha256:91816d4223b01ac10ac9bf2e1a37216bddaecb4656f03969c9c25eb73ab77ebb", "ResolvConfPath": "/var/lib/docker/containers/5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431/resolv.conf", "HostnamePath": "/var/lib/docker/containers/5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431/hostname", "HostsPath": "/var/lib/docker/containers/5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431/hosts", "LogPath": "/var/lib/docker/containers/5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431/5705af510fdb7b9daf0859b3533b168ad3c1cddcf210419b15693df018fa4431-json.log", "Name": "/openvpn5", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "docker-default", "ExecIDs": null, "HostConfig": { "Binds": [ "/home/ubuntu/openvpn/:/home/openvpn/config" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "443/tcp": [ { "HostIp": "", "HostPort": "2443" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "ConsoleSize": [ 93, 317 ], "CapAdd": [ "NET_ADMIN" ], "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", "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": [], "BlkioDeviceWriteBps": [], "BlkioDeviceReadIOps": [], "BlkioDeviceWriteIOps": [], "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [ { "PathOnHost": "/dev/net/tun", "PathInContainer": "/dev/net/tun", "CgroupPermissions": "rwm" } ], "DeviceCgroupRules": null, "DeviceRequests": null, "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", "/sys/devices/virtual/powercap" ], "ReadonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/066caeac17e2593bbf140367c38b26272faa7ce951c919b209e50c839f81496e-init/diff:/var/lib/docker/overlay2/ce93af99fd3678e87924e715c7a106dcf1774e484807fc66b8d39b9f695783c8/diff:/var/lib/docker/overlay2/8cbf2278e6819bf5b77051b4389a4a6a1cff7794c5b2834b2111232f794a4270/diff:/var/lib/docker/overlay2/d05f45c54548040789e259f4c92a813d1ca65932e75209276c9ab020b3be4293/diff:/var/lib/docker/overlay2/a1211c965a73c8c2f60c08f01d6a85c53685efa941c90986432c09fa6d8b8896/diff:/var/lib/docker/overlay2/3749b8237e5e031fa01076b41cabbae61011f1dbf11a4178c1587413c4f5f761/diff:/var/lib/docker/overlay2/24b12035931e6c6924f1b3c6e806ded87417ecf3c3eca3d7a49a2d89826a7c6b/diff:/var/lib/docker/overlay2/7766c7f18ef202018acc109921abf305ef5ec295648c5f4a983217e7650ba226/diff:/var/lib/docker/overlay2/b1824107281894f9d502ada016189e9e79cfb37a819101272df3ae4f6136b9ee/diff", "MergedDir": "/var/lib/docker/overlay2/066caeac17e2593bbf140367c38b26272faa7ce951c919b209e50c839f81496e/merged", "UpperDir": "/var/lib/docker/overlay2/066caeac17e2593bbf140367c38b26272faa7ce951c919b209e50c839f81496e/diff", "WorkDir": "/var/lib/docker/overlay2/066caeac17e2593bbf140367c38b26272faa7ce951c919b209e50c839f81496e/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "bind", "Source": "/home/ubuntu/openvpn", "Destination": "/home/openvpn/config", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "5705af510fdb", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "443/tcp": {}, "443/udp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "DEBIAN_FRONTEND=noninteractive" ], "Cmd": null, "Image": "openvpn4", "Volumes": null, "WorkingDir": "/home/openvpn", "Entrypoint": [ "/home/openvpn/reload-config.sh" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "bb9df0f8482dbd5becac2071545eaa57bf32d223bb60e0ebccf781a4c526612c", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "443/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "2443" }, { "HostIp": "::", "HostPort": "2443" } ], "443/udp": null }, "SandboxKey": "/var/run/docker/netns/bb9df0f8482d", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "11c431ad0e7c75a8b816c3979021423337d5819842a94da7d593acc806f84f84", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:03", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "5de3a464f4f90e12db3396b2e8bbf30f032bd6cb46fc49b1065d71b65de74d6b", "EndpointID": "11c431ad0e7c75a8b816c3979021423337d5819842a94da7d593acc806f84f84", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:03", "DriverOpts": null } } } } ]