1. The problem I’m having:
I’m new to caddy and ipv6 so…
I have a dual-stack machine. It is currently running a web services which is bound to its only ipv4 address.
I’m looking to bring up a second webserver (uptime-kuma) which binds to the ipv6 address.
I have the following docker compose file:
version: '3'
networks:
default:
name: 'proxy_network'
services:
uptime-kuma:
image: louislam/uptime-kuma:1
restart: unless-stopped
volumes:
- /opt/kuma-monitor/kumadata:/app/data
ports:
- 2052:3001
labels:
caddy: status.onepub.dev
caddy.reverse_proxy: "* {{upstreams 2052}}"
caddy:
image: "lucaslorentz/caddy-docker-proxy:ci-alpine"
ports:
- " [::]:80:80"
- " [::]:443:443"
# - "80:80"
#- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/kuma-monitor/cadydata/:/data
restart: unless-stopped
environment:
- CADDY_INGRESS_NETWORKS=proxy_network
The port mapping was suggested by chat-gpt but that doesn’t work.
services.caddy.ports contains an invalid type, it should be a number, or an object
services.caddy.ports contains an invalid type, it should be a number, or an object
So what do I need in my docker-compose file and do I need to do any special caddy configuration outside the docker-compose file.
2. Error messages and/or full log output:
docker-compose up
ERROR: The Compose file './docker-compose.yaml' is invalid because:
services.caddy.ports contains an invalid type, it should be a number, or an object
services.caddy.ports contains an invalid type, it should be a number, or an object
3. Caddy version:
I’m using docker compose the suggested command docker-compose exec caddy caddy version
outputs a blank line.
The docker-compose references the image ‘"lucaslorentz/caddy-docker-proxy:ci-alpine’
4. How I installed and ran Caddy:
Using the above noted docker-compose file.
a. System environment:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
docker --version
Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1
docker-compose --version
docker-compose version 1.29.2, build unknown
b. Command:
docker-compose up
c. Service/unit/compose file:
version: '3'
networks:
default:
name: 'proxy_network'
services:
uptime-kuma:
image: louislam/uptime-kuma:1
restart: unless-stopped
volumes:
- /opt/kuma-monitor/kumadata:/app/data
ports:
- 2052:3001
labels:
caddy: status.onepub.dev
caddy.reverse_proxy: "* {{upstreams 2052}}"
caddy:
image: "lucaslorentz/caddy-docker-proxy:ci-alpine"
ports:
- " [::]:80:80"
- " [::]:443:443"
# - "80:80"
#- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/kuma-monitor/cadydata/:/data
restart: unless-stopped
environment:
- CADDY_INGRESS_NETWORKS=proxy_network
d. My complete Caddy config:
I’m using an image (as noted above) with no changes to the config.
here is the output from the docker inspect
docker inspect kuma-monitor_caddy_1
[
{
"Id": "280bab62b42df49a406601e58c15c5e4a26fb417ec42922f31d21f6cafb10379",
"Created": "2024-03-04T05:11:50.415384304Z",
"Path": "/bin/caddy",
"Args": [
"docker-proxy"
],
"State": {
"Status": "created",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 128,
"Error": "driver failed programming external connectivity on endpoint kuma-monitor_caddy_1 (b1a9d04753823021c4ade09d43187b1f8b3f6d360e19142421f545c81ef27b2b): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use",
"StartedAt": "0001-01-01T00:00:00Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:4a210a0f9d3e579c4c21558bf3f7eb6a4bd9559f06b63b92610ac8c24fb21386",
"ResolvConfPath": "/var/lib/docker/containers/280bab62b42df49a406601e58c15c5e4a26fb417ec42922f31d21f6cafb10379/resolv.conf",
"HostnamePath": "",
"HostsPath": "/var/lib/docker/containers/280bab62b42df49a406601e58c15c5e4a26fb417ec42922f31d21f6cafb10379/hosts",
"LogPath": "",
"Name": "/kuma-monitor_caddy_1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/var/run/docker.sock:/var/run/docker.sock:ro",
"/opt/kuma-monitor/cadydata:/data:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "proxy_network",
"PortBindings": {
"443/tcp": [
{
"HostIp": "",
"HostPort": "443"
}
],
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": [],
"ConsoleSize": [
0,
0
],
"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",
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"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"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/1fa46d5554f26a3bee736eefba34b501637555760588cde52748bc99bb0e523b-init/diff:/var/lib/docker/overlay2/e121c47518595472abe13eacd93392d3c92477ebc2b103bdce9aea74c356bd4a/diff:/var/lib/docker/overlay2/e720a151e44c7bfba51b9b04f2c52029b5b981e2cb785459d0e6d705d33c4b9b/diff:/var/lib/docker/overlay2/158d17841fa3b05713ade9d89047c89608ead8652e5707005142f79d3d74afea/diff",
"MergedDir": "/var/lib/docker/overlay2/1fa46d5554f26a3bee736eefba34b501637555760588cde52748bc99bb0e523b/merged",
"UpperDir": "/var/lib/docker/overlay2/1fa46d5554f26a3bee736eefba34b501637555760588cde52748bc99bb0e523b/diff",
"WorkDir": "/var/lib/docker/overlay2/1fa46d5554f26a3bee736eefba34b501637555760588cde52748bc99bb0e523b/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/opt/kuma-monitor/cadydata",
"Destination": "/data",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/var/run/docker.sock",
"Destination": "/var/run/docker.sock",
"Mode": "ro",
"RW": false,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "280bab62b42d",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"2019/tcp": {},
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"CADDY_INGRESS_NETWORKS=proxy_network",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"XDG_CONFIG_HOME=/config",
"XDG_DATA_HOME=/data"
],
"Cmd": [
"docker-proxy"
],
"Image": "lucaslorentz/caddy-docker-proxy:ci-alpine",
"Volumes": {
"/data": {},
"/var/run/docker.sock": {}
},
"WorkingDir": "",
"Entrypoint": [
"/bin/caddy"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "3a8f635a31e4b58e232d48cb384434bd5c800bfbcb2354060c184f7758613218",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "kuma-monitor",
"com.docker.compose.project.config_files": "docker-compose.yaml",
"com.docker.compose.project.working_dir": "/opt/kuma-monitor",
"com.docker.compose.service": "caddy",
"com.docker.compose.version": "1.29.2",
"maintainer": "Lucas Lorentz <lucaslorentzlara@hotmail.com>"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "d6278cff3dd3b3484711cb70769fbf16b4012dce8bca781f4af0412f0f440cad",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/d6278cff3dd3",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"proxy_network": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"caddy",
"280bab62b42d"
],
"NetworkID": "ad44255a0712950d2b5ea4e85bc9d6dcc74603308d672a0112bcd8b1ede7a0f6",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]