Comments (10)
Ok. Won't fit my use case then. I have no need to publish ports with Traefik. Best of luck to you anyway. Hope people use it.
from docktor.
Hey, thanks for notice! I think the issue was here:
port := strconv.FormatUint(uint64(container.Ports[1].PublicPort), 10)
Firstly, the code was checking if the container array length was > 1, which meant it never checked if only one container was passed (this was really stupid of me). Also, Index 1 of container.Ports was causing the error too on my end - changing this to index 0 fixed it. Let me know if this worked for you.
Edit: I just pushed the changes to master, so you should be good to see if this fixed on your end.
from docktor.
Nope. Still not working. This time it listed everything I have running and then
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/nishgowda/docktor/lib/healthcheck.PerformHealthCheck(0xc00028be40, 0x1, 0x1, 0x4, 0xac7980, 0x4, 0x5e1c00)
/home/inamati/docktor/lib/healthcheck/healthcheck.go:40 +0x7c0
github.com/nishgowda/docktor/bin/cmd.glob..func3(0xf93200, 0xc000223640, 0x0, 0x2)
/home/inamati/docktor/bin/cmd/healthcheck.go:17 +0x49
github.com/spf13/cobra.(*Command).execute(0xf93200, 0xc000223620, 0x2, 0x2, 0xf93200, 0xc000223620)
/home/inamati/go/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xf934a0, 0x0, 0x82380, 0xc000090058)
/home/inamati/go/pkg/mod/github.com/spf13/[email protected]/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
/home/inamati/go/pkg/mod/github.com/spf13/[email protected]/command.go:887
github.com/nishgowda/docktor/bin/cmd.Execute(...)
/home/inamati/docktor/bin/cmd/root.go:26
main.main()
/home/inamati/docktor/bin/main.go:8 +0x2e
from docktor.
Is the container you're running on a port? That function restarts the container on it's port so if it's not then it won't work - I'll also make a quick check of this. Try running it with nginx like the example and see if it works.
from docktor.
What do you mean? I ran it against a service like the following:
drop:
image: ghcr.io/linuxserver/snapdrop
container_name: drop
<<: *tiny
depends_on:
- rsshub
networks:
- traefik
environment:
- PUID=$PUID
- PGID=$PGID
- TZ=$TZ
volumes:
- drop:/config
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.drop.entrypoints=https"
- "traefik.http.routers.drop.rule=Host(`$DROP_SUBDOMAIN.$DOMAINNAME1`)"
- "traefik.http.routers.drop.tls=true"
## HTTP Services
- "traefik.http.routers.drop.service=drop"
- "traefik.http.services.drop.loadbalancer.server.port=80"
- "traefik.http.routers.drop.middlewares=chain-no-auth@file"
from docktor.
Basically the issue is that the docker api can't find the port exposed in that container - this is likely to do with some part of the configuration of your container. I'm guessing that's a compose file but I don't see a port exposed on it. Again, try running it on another container that's using an existing port on your system.
PS: I edited the code so it won't work if the docker api can't find the port - it's just not going to do anything instead.
from docktor.
It does expose a port. It just doesn't publish it.
from docktor.
That might be the problem then try publishing the port or try on another container that has published its port.
from docktor.
What is the command you use to get the port the container is using?
from docktor.
The full code is in the health check part of the lib directory. Also, by looking at the screen shot it doesn't look like it's published a port on your local machine (if that's all docker ps says that is). If you run your container with the -p command and map it to a port it should work.
from docktor.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docktor.