Skip to content

How do I get the logs for a service? #26282

Answered by dakale
colinhowetab asked this question in Actions
Discussion options

You must be logged in to vote

https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-context

You can get the ID of a service container with “${{ job.services.<service_id>.id }}”

With that you can do any regular docker operation you’d like, for example:

docker logs "${{ job.services.<service_id>.id }}"

Heres a full working sample I have of using mysql:

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_ROOT_PASSWORD: password
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    steps:
    - name: Verify MySQL connection fro…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants