Behavior for a local action with custom Dockerfile name

I’m practicing with the tutorial at Creating a Docker container action - GitHub Docs at a local repository. And I want to confirm if runs.image must be always set as a file named Dockerfile

Right now, I’m already able to run a Workflow which makes use of the following action, allocated on the same repository:

# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'docker'
  image: '../../docker/Dockerfile'
  args:
    - ${{ inputs.who-to-greet }}

However, when I update runs.image to '../../docker/Dockerfile.deps' , and rename my Dockerfile accordingly, Docker build fails with the following error:

docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.

Inspecting the full exec of docker run I see the following :

/usr/bin/docker run --name dockerDockerfiledeps_5a2ebf --label 5588e4 --workdir /github/workspace --rm -e INPUT_WHO-TO-GREET -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/hello-world-docker-action/hello-world-docker-action":"/github/workspace" ../../docker/Dockerfile.deps  "Mona the Octocat"

Yet, when I inspected the last successful job I saw the following differences:

  1. --name is set to --name e45778deb9dbdf5cef58a9b40b3de2f2a8_98bb3e
  2. Before the “Mona the Octocat” argument is given 5588e4:5778deb9dbdf5cef58a9b40b3de2f2a8
  3. Only the successful jobs has a call to docker build while the job that failed seems to have gone directly to docker run.

I hope that the following screenshot helps show the latest point:

Therefore, is this the expected behavior ? Or Am I facing a bug with runs.image?

Bump, I’m having the same issue. I have a regular Dockerfile that is used for deployment and then a Dockerfile.test that I use for a test environment that I want GH Actions to use.

action.yml:

name: 'Run detect pytest'
runs:
  using: 'docker'
  image: 'Dockerfile.test'

Always throws this:

Run ./.github/actions
/usr/bin/docker run --name Dockerfiletest_831369 --label 5588e4 --workdir /github/workspace --rm -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/detect/detect":"/github/workspace" Dockerfile.test
docker: invalid reference format: repository name must be lowercase.

Bump. This should be an “unintended” bug. GitHub should allows user to use custom Dockerfile, including custom-named Dockerfile. The current situation is GH Action only support Dockerfile that literally named Dockerfile. Based on my and @skrawn issue, this is caused by GH Action runner passed --name <Dockerfile-name-here> argument to docker run. docker run --name doesn’t support uppercase for their argument, which is the behaviour of GH Action if we use custom-named Dockerfile.

This issue could be fixed easily by make the --name argument behavior pass the same argument without the Dockerfile filename as if we use literal Dockerfile for our Dockerfile (refer to @rfuentess picture. Looks like it is just randomized strings).