Coder Social home page Coder Social logo

Comments (3)

AYEG avatar AYEG commented on May 2, 2024

One more thing I tried is edit docker-stack.yml to include

logging:
driver: journald

Then run this command:
$ journalctl -u docker CONTAINER_NAME=db

As described here:
https://stackoverflow.com/questions/43663013/access-logs-of-a-killed-docker-container/43663253

It tells me:
-- Logs begin at Mon 2018-11-12 21:37:13 CET, end at Thu 2018-12-27 14:15:03 CET. --
-- No entries --

from full-stack.

AYEG avatar AYEG commented on May 2, 2024

Found a way to print errors here is a possible solution for anyone else wondering how to do this:

docker service ls // list the services
docker service ps <id> // shows container id and a truncated error message in second to last column
docker inspect <container id from first column> | grep Err // print out the error message belonging to the service container

"Err": "no suitable node (scheduling constraints not satisfied on 1 node)"

Running these commands no longer requires enabling experimental docker features, it works by default

from full-stack.

tiangolo avatar tiangolo commented on May 2, 2024

Sorry for the delay.

When you create a Docker Swarm mode stack, all the "services" get a name prefixed by the stack name.

So, if you create a stack my-super-app-com, your backend service will be named my-super-app-com_backend.

Then you can see the logs with:

docker service logs my-super-app-com_backend

To see only the last 100 logs:

docker service logs my-super-app-com_backend --tail=100

To see only the last 100 logs and keep showing any new logs live, "following" the logs:

docker service logs my-super-app-com_backend --tail=100 -f

(This last one is what I use the most).

from full-stack.

Related Issues (16)

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.