question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't create a container since the provided tag name is different from the one I provided

See original GitHub issue

Behaviour

Steps to reproduce this issue

  1. Create/build an image because we want to test if the changes pass (following https://github.com/docker/build-push-action/blob/master/docs/advanced/test-before-push.md):
-  uses: actions/checkout@v3.0.2
   if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
   with:
      submodules: 'recursive'
      ref: ${{ env.BUILD_REF }}
-  name: Set up Docker Buildx
   if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
   uses: docker/setup-buildx-action@v2
-  name: Test docker
   if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
   run: |
      docker pull hello-world > /dev/null
      docker run --rm hello-world > /dev/null
-  name: Build and export to Docker
   if: ${{ env.CREATE_BUILD == 'true' && (env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id) }}
   uses: docker/build-push-action@v3
   with:
      context: .
      load: true # If true, once the image has been pulled or built, it will be available from docker
      push: false
      tags: ${{ env.DOCKER_IMAGE_TAG }}
  1. Create a container using docker run:
-  name: Run
   if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
   run: |
      mkdir "${WORK}/docker-volume"

      # Run tests with docker
      docker run \
         -e CI="$CI" \
         -v "${WORK}/docker-volume:${WORK_DOCKER}/volume" \
         --name bitextor \
         --entrypoint /bin/bash --rm \
         "${DOCKER_IMAGE_TAG}" \
         -c 'bitextor/tests/run-tests.sh -t ${{ matrix.test_id }}; \
             cp -f '"${WORK_DOCKER}/data/fails.log"' '"${WORK_DOCKER}/volume"' && \
             rm -rf '"${WORK_DOCKER}/volume/reports"' && \
             cp -r '"${WORK_DOCKER}/reports"' '"${WORK_DOCKER}/volume"' && \
             cp -r '"${WORK_DOCKER}/permanent"' '"${WORK_DOCKER}/volume"''

Expected behaviour

It should create the container and run the tests.

Actual behaviour

But, when docker run is invoked, it says it doesn’t find the image:

Unable to find image 'bitextor/bitextor:testtag' locally
docker: Error response from daemon: manifest for bitextor/bitextor:testtag not found: manifest unknown: manifest unknown.
See 'docker run --help'.

The value of ${{ env.DOCKER_IMAGE_TAG }} is “bitextor/bitextor:testtag”, but looking in the logs, I’ve found out in the metadata that the image name is “docker.io/bitextor/bitextor:testtag” (is this “docker.io/” prefix expected? At least, in the documentation about testing, they use the same envvar for creating the build and test, and I haven’t seen anything about this prefix in the documentation):

  {
    "containerimage.buildinfo": {
      "frontend": "dockerfile.v0",
      "attrs": {
        "filename": "Dockerfile"
      },
      "sources": [
        {
          "type": "docker-image",
          "ref": "docker.io/library/ubuntu:20.04",
          "pin": "sha256:fd92c36d3cb9b1d027c4d2a72c6bf0125da82425fc2ca37c414d4f010180dc19"
        }
      ]
    },
    "containerimage.config.digest": "sha256:3c0a872aabbd7a90939f2bd9d1bd3cf15a00dcdb0d229ce793655f2459415978",
    "containerimage.descriptor": {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:7dbf8133fdd907d63ddff7393d2d74a7271fae46741a8082aa2bc5621b00d075",
      "size": 13286,
      "annotations": {
        "org.opencontainers.image.created": "2022-08-01T13:22:32Z"
      }
    },
    "containerimage.digest": "sha256:7dbf8133fdd907d63ddff7393d2d74a7271fae46741a8082aa2bc5621b00d075",
    "image.name": "docker.io/bitextor/bitextor:testtag"
  }

Configuration

name: Intensive tests with docker

on:
   schedule:
      - cron: '0 3 * * 0'
   workflow_dispatch:
      inputs:
         docker_tag:
            description: 'Tag which will be looked for'
            required: false
            default: 'edge'
         create_build:
            type: boolean
            description: 'Create build instead of downloading an image'
            default: true
         build_ref:
            description: 'Ref to use when local build is created (i.e. branch, tag or commit)'
            default: 'master'
         test_id:
            description: 'Run specific test ID'
            required: false
            default: 'all'
            type: choice
            options:
               - 'all'
               - '0x01'
               - '0x02'
               - '0x04'
               - '0x08'
               - '0x10'
               - '0x20'
               - '0x40'
               - '0x80'

env:
   WORK: ${{ github.workspace }}
   WORK_DOCKER: '/home/docker'
   TEST_ID: ${{ github.event.inputs.test_id || 'all' }}
   DOCKER_IMAGE_TAG: ${{ format('bitextor/bitextor:{0}', github.event.inputs.docker_tag || 'edge') }}
   CREATE_BUILD: ${{ github.event.inputs.create_build || 'true' }}

jobs:
   tests:
      name: ${{ matrix.name }}
      runs-on: ubuntu-20.04
      timeout-minutes: 1440
      strategy:
         fail-fast: false # Continue even when a matrix job fails in order to detect as many errors as possible
         matrix:
            include:
               - name: Tests MT
                 test_id: "0x01"
               - name: Tests dictionary based
                 test_id: "0x02"
               - name: Tests generate dictionary
                 test_id: "0x04"
               - name: Tests generate bicleaner model
                 test_id: "0x08"
               - name: Tests generate dictionary and bicleaner model
                 test_id: "0x10"
               - name: Tests combining dictionaries and MT
                 test_id: "0x20"
               - name: Tests neural
                 test_id: "0x40"
               - name: Other tests
                 test_id: "0x80"
      steps:
      -  uses: actions/checkout@v3.0.2
         if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
         with:
            submodules: 'recursive'
            ref: ${{ env.BUILD_REF }}
      -  name: Set up Docker Buildx
         if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
         uses: docker/setup-buildx-action@v2
      -  name: Test docker
         if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
         run: |
            docker pull hello-world > /dev/null
            docker run --rm hello-world > /dev/null
      -  name: Build and export to Docker
         if: ${{ env.CREATE_BUILD == 'true' && (env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id) }}
         uses: docker/build-push-action@v3
         with:
            context: .
            load: true # If true, once the image has been pulled or built, it will be available from docker
            push: false
            tags: ${{ env.DOCKER_IMAGE_TAG }}
      -  name: Pull image
         if: ${{ env.CREATE_BUILD == 'false' && (env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id) }}
         run: |
            docker pull "$DOCKER_IMAGE_TAG"
      -  name: Run
         if: ${{ env.TEST_ID == 'all' || env.TEST_ID == matrix.test_id }}
         run: |
            mkdir "${WORK}/docker-volume"

            # Run tests with docker
            docker_exit_code=$(
            docker run \
               -e CI="$CI" \
               -v "${WORK}/docker-volume:${WORK_DOCKER}/volume" \
               --name bitextor \
               --entrypoint /bin/bash --rm \
               "${DOCKER_IMAGE_TAG}" \
               -c 'bitextor/tests/run-tests.sh -t ${{ matrix.test_id }}; \
                   cp -f '"${WORK_DOCKER}/data/fails.log"' '"${WORK_DOCKER}/volume"' && \
                   rm -rf '"${WORK_DOCKER}/volume/reports"' && \
                   cp -r '"${WORK_DOCKER}/reports"' '"${WORK_DOCKER}/volume"' && \
                   cp -r '"${WORK_DOCKER}/permanent"' '"${WORK_DOCKER}/volume"'' \
               &> ./tests_output \
               && echo $? || echo $?)

            if [[ "$docker_exit_code" != "0" ]]; then
               >&2 echo "WARNING: something went wrong while tests were running"
            fi

            cat ./tests_output

            # Has the execution failed?
            nolines=$(cat ${WORK}/docker-volume/fails.log | wc -l)

            [[ "$nolines" != "0" ]] && exit "$nolines" || true
      -  name: Print log of tests which failed
         # https://github.com/actions/runner/issues/1173
         #if: ${{ steps.tests.conclusion != 'success' }} # Will this work with matrix as expected (i.e. affect just the specific job and not the rest)?
         if: ${{ always() }}
         run: |
            if [[ -f "${WORK}/docker-volume/fails.log" ]]; then
               while read line; do
                  IFS=$'\t' read -r -a array <<< "$line"
                  status=${array[0]}
                  notest=${array[1]}
                  exit_code=${array[2]}

                  str="# Test $notest (exit code / desc.: $exit_code) #"
                  eval $(echo printf '"#%0.s"' {1..${#str}}) && printf "\n"
                  echo "$str"
                  eval $(echo printf '"#%0.s"' {1..${#str}}) && printf "\n"

                  report_file="${WORK}/docker-volume/reports/${notest}.report"

                  if [[ -f "$report_file" ]]; then
                     awk -v prefix="(log test $notest)" '{print prefix" "$0}' "$report_file"
                  else
                     echo "(warning) No report file found for test $notest (this might be normal depending on the test; check the description)"
                  fi

                  echo ""
               done < "${WORK}/docker-volume/fails.log"
            else
               >&2 echo "ERROR: could not find the file which contain the fails, and should exist"
            fi
      -  name: Upload sent.gz files (artifacts)
         if: ${{ always() }}
         uses: actions/upload-artifact@v3
         with:
            name: all-sent.gz
            path: ${{ env.WORK }}/docker-volume/permanent/**/*.sent.gz
      -  name: Upload report files (artifacts)
         if: ${{ always() }}
         uses: actions/upload-artifact@v3
         with:
            name: reports
            path: ${{ env.WORK }}/docker-volume/reports/*.report

Logs

logs_3461.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
crazy-maxcommented, Sep 2, 2022

Hum ok looking at the image being built I think it’s the same issue as https://github.com/docker/build-push-action/issues/321 where load silently fails because of insufficient disk space. You can remove some components pre-installed on the runner in your workflow like dotnet (~23GB):

  - name: Remove dotnet
    run: sudo rm -rf /usr/share/dotnet

Closing this issue since that should answer your question and seems a duplicated of #321, but feel free to re-open if it doesn’t. Thanks.

0reactions
cgr71iicommented, Aug 3, 2022

No, it’s the right link. I forgot to mention that you should check out the step “Run”. It hasn’t failed because, if you check the script, it is not expected to fail when docker run is invoked (it is expected to run correctly, and fail for the tests of the project). And about the other jobs that are “cancelled” is because of https://github.com/actions/checkout/issues/794#issuecomment-1202124176, which I suspect is an issue related to this action as well since it only happens to me with this workflow, which is the only one that uses this action. I’m looking into it, and perhaps I’ll open another issue about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's Wrong With The Docker :latest Tag? - vsupalov.com
It's just the tag which is applied to an image by default which does not have a tag. Those two commands will both...
Read more >
Set up and install Tag Manager - Google Support
1. Create a new account and container · In Tag Manager, click the Accounts tab > Create account. · Enter an Account Name...
Read more >
Tagging your Amazon ECS resources - AWS Documentation
This topic provides an overview of tags in Amazon ECS and how you can create them. To use this feature, you must opt...
Read more >
Naming and Referencing Containers, Blobs, and Metadata
The URI to reference a container or a blob must be unique. Because every account name is unique, two accounts can have containers...
Read more >
docker tag
Note that since the tag name is not specified, the alias is created for an existing local version httpd:latest . Tag an image...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found