How do I get the logs for a service?


I’ve got several services that my job depends on. I’m fairly certain one of them is misbehaving. I’d like to view the logs for them, but, I can’t see them anywhere within github actions. Any suggestions?


At the top right corner of the Actions tab, there is a link to view the raw logs. 


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

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

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

Heres a full working sample I have of using mysql:

    runs-on: ubuntu-latest
        image: mysql:5.7
          MYSQL_ROOT_PASSWORD: password
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    - name: Verify MySQL connection from host
      run: |
        echo "${{ toJson(job) }}"
        sudo apt-get install -y mysql-client
        mysql --host --port ${{['3306'] }} -uroot -ppassword -e "SHOW DATABASES"
        docker logs "${{ }}"

The logs from the service container will then be in the logs of the step where you ran docker logs, as expected 

Depending on the service, docker logs may not work. See:


Thank you!

Not sure where to put feature requests… would be good to have these automatically extracted and viewable within a tab somewhere in the UI. When a build fails I’d rather not have to start adding calls to docker to try and diagnose the failure :slight_smile:

This would not work if the “Initialize containers” step has failed. How do we troubleshoot such a failure?

See for example

1 Like

I’d like to know this too, I am having a similar issue with a MariaDB service (which incidentally was working fine a couple of days ago).