Tudor Ravoiu
Tudor Ravoiu

Reputation: 2150

Docker push fails after multiple retries on a specific layer

I'm trying to push my own Docker image for an Angular 5 project that I've built. My docker image extends the well known node:carbon image and runs the following commands:

FROM node:carbon

WORKDIR /usr/src/app

COPY package.json .
COPY package-lock.json .

RUN npm install --no-optional

COPY . .

EXPOSE 8080

CMD ["npm", "start"]

The package.json file has the following content:

{
  "name": "turist-front",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.2",
    "@angular-devkit/core": "^0.3.1",
    "@angular/animations": "^5.0.5",
    "@angular/cdk": "^5.0.0-rc.2",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/flex-layout": "^2.0.0-beta.11",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.0.0-rc.2",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "@swimlane/ngx-datatable": "^11.1.5",
    "angular-l10n": "^4.1.2",
    "angular2-notifications": "^0.9.6",
    "core-js": "^2.4.1",
    "d3": "^4.11.0",
    "hammerjs": "^2.0.8",
    "material-design-icons": "^3.0.1",
    "ng2-dragula": "^1.5.0",
    "ngx-auth": "^3.0.0",
    "ngx-dropzone-wrapper": "^5.2.0",
    "ngx-perfect-scrollbar": "^5.0.1",
    "ngx-quill": "^2.0.3",
    "normalize.css": "^7.0.0",
    "rxjs": "5.5.2",
    "screenfull": "^3.3.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.5.5",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@compodoc/compodoc": "^1.0.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "hads": "^1.5.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }
}

After I've built my image I want to push it to my docker repository. But although I've tried at least 5 times to execute the docker push command, every time it fails with the error file integrity checksum failed for. It is not always the same file that fails the integrity check and I also didn't notice any timeout behaviour or something similar.

What I have noticed is that the one layer (always the same) fails being pushed and it restarts 5-6 times unsuccessful:

cc19355015b5: Pushing [=======>    ]  98.66MB/653.4MB

and than

cc19355015b5: Pushing [=======>    ]  Retrying in 5 seconds

Upvotes: 4

Views: 13520

Answers (2)

Serguei
Serguei

Reputation: 278

Another way to solve this is to reduce the amount of data that are sent at a time to the registry, by breaking up the layers or using a tool like regclient that falls back to sending 1MB chunks by default if larger chunks don't succeed at first.

The steps are:

  1. Download regctl
  2. Save the image as a tar file
  3. Push it to the registry using regctl
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > regctl
chmod 755 regctl
docker save <imagename> > image.tar
./regctl image import <imagename> image.tar -v debug

The chunk size can be configured. See this answer for more in-depth details.

Upvotes: 1

moon
moon

Reputation: 571

I had the same issue today, then I found a typo in my ECR location, once it is corrected, the push succeeded immediately, so I believe Docker just doesn't tell you that it can't find the ECR repo and stuck in retrying.

Upvotes: 3

Related Questions