Docker Community Forums

Share and learn in the Docker community.

Running Docker Images without GitHub CI Hanging

I’m trying to use GitHub Actions to run a docker image though the last command doesn’t actually finish up if that makes sense. The Docker Image does run although, despite the & and nohup, the specific step is marked as running forever until the docker image is stopped or killed. Is there an alternative command (nohup docker run --env-file=Timmy-SchoolSimplified/.env timmy &) that doesn’t “hang” and immediately moves on?

This is my current workflow:

name: SSH & Deploy Image
on:
  workflow_run:
    workflows: ["Timmy Docker Build"]
    branches: [ main ]
    types:
      - completed

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - name: Run Docker CMD
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.PASSWORD }}
        port: ${{ secrets.PORT }}
        script: |
          docker rm $(docker stop $(docker ps -a -q --filter ancestor=timmy --format="{{.ID}}"))
          docker pull spaceturtle0/ss-timmy:latest
          docker tag spaceturtle0/ss-timmy timmy
          nohup docker run --env-file=Timmy-SchoolSimplified/.env timmy &

Sorry, it could be a stupid question since I don’t use GitHub CI, but is there any reason you don’t use “-d” with docker run to run the process in the background instead of relying on the job control in bash with nohup and &? Will GitHub CI somehow use nohop.out file to show you some status information?