GithubHelp home page GithubHelp logo

Not Working about docktor HOT 10 CLOSED

The-Inamati avatar The-Inamati commented on May 26, 2024
Not Working

from docktor.

Comments (10)

The-Inamati avatar The-Inamati commented on May 26, 2024 1

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.

nishgowda avatar nishgowda commented on May 26, 2024

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.

The-Inamati avatar The-Inamati commented on May 26, 2024

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.

nishgowda avatar nishgowda commented on May 26, 2024

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.

The-Inamati avatar The-Inamati commented on May 26, 2024

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.

nishgowda avatar nishgowda commented on May 26, 2024

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.

The-Inamati avatar The-Inamati commented on May 26, 2024

It does expose a port. It just doesn't publish it.
image

from docktor.

nishgowda avatar nishgowda commented on May 26, 2024

That might be the problem then try publishing the port or try on another container that has published its port.

from docktor.

The-Inamati avatar The-Inamati commented on May 26, 2024

What is the command you use to get the port the container is using?

from docktor.

nishgowda avatar nishgowda commented on May 26, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.