Docker Health Check

Anything look wrong here to you guys?
32 Replies
Perfect
PerfectOP•3y ago
the health check seems to be acting very weird
Ahmad
Ahmad•3y ago
weird how?
Perfect
PerfectOP•3y ago
its not working @0xahmad probably should have clarified that haha it makes the db just exit
Ahmad
Ahmad•3y ago
I don't do health checks in docker-compose but did you try the test with
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
// or
test: ["CMD-SHELL", "sh -c 'pg_isready -U postgres -d dbname'"]
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
// or
test: ["CMD-SHELL", "sh -c 'pg_isready -U postgres -d dbname'"]
?
Perfect
PerfectOP•3y ago
I did, but it turns out this is exactly the same as what I have now, CMD SHELL is implied I solved it, turns out it actually was unhealthy and I was getting some postgres errors I was not able to see at first in the vastness of logs I was getting
Ahmad
Ahmad•3y ago
Cool, I was gonna say connect a volume with the logs dir, and check them
Perfect
PerfectOP•3y ago
yah, found them in docker desktop actually wish there was a way to just see logs for a certain service probably is i just dont know it my docker compose terminal just spits out every service together its so much
Ahmad
Ahmad•3y ago
i think you can stream logs of each container, I just never tried it out
Perfect
PerfectOP•3y ago
yeah might have to look into that later or just use docker desktop thx for ur help tho, much appreciated! @0xahmad oh and also
Ahmad
Ahmad•3y ago
?
Perfect
PerfectOP•3y ago
you said you dont do health checks in docker compose, how do u do them? (if at all)
Ahmad
Ahmad•3y ago
I moved to k8 so I do my health chesk in it now it's connected to a monitoring system which keeps track of what svc is healthy and not
Perfect
PerfectOP•3y ago
ahhh ok havent learned kubernetes yet
Ahmad
Ahmad•3y ago
I only use docker-compose for local dev deployment is always either k8 or cloud
Perfect
PerfectOP•3y ago
oh so we can switch over relatively easy?
Ahmad
Ahmad•3y ago
if you don't need it then stick to what you know 👋
Perfect
PerfectOP•3y ago
dont need it but yeah probably cool to try it out haha
Ahmad
Ahmad•3y ago
not really it's a learning curve but if you know you'll need it then it's good to learn it
Perfect
PerfectOP•3y ago
school project gives us extra credit for it so might try it out
Ahmad
Ahmad•3y ago
I'm working on larger projects so I need to know devops inside out
Perfect
PerfectOP•3y ago
yeah I bet
Ahmad
Ahmad•3y ago
that's nice you should learn it
Perfect
PerfectOP•3y ago
docker compose is only for a single machine right? so not meant for scaling
Ahmad
Ahmad•3y ago
it's not hard, just a hek ton of yaml to write
Perfect
PerfectOP•3y ago
just meant for setting up containers easier?
Ahmad
Ahmad•3y ago
scratch that, checkout pulumi, you can code your configurations
Perfect
PerfectOP•3y ago
i figured a lot of setup/config yeah
Ahmad
Ahmad•3y ago
no I think it's scalable docker-swarm from what I remember
Perfect
PerfectOP•3y ago
oh right swarm so many options
Ahmad
Ahmad•3y ago
docker is everywhere, it's just more abstractions over that k8 is just an abstraction over docker(or any other containerizer)
Perfect
PerfectOP•3y ago
more abstractions yay abstractions never end lmao
Ahmad
Ahmad•3y ago
yea sad story haha you have to weigh the abstraction cost over the requirements. I'd say it's healthy as long as you're careful

Did you find this page helpful?