mirror of
				https://gitea.com/docker/build-push-action.git
				synced 2025-10-31 00:58:18 +07:00 
			
		
		
		
	Merge pull request #203 from crazy-max/update-troubleshooting
Update troubleshooting notes
This commit is contained in:
		
						commit
						41a004098f
					
				| @ -1,6 +1,114 @@ | ||||
| # Troubleshooting | ||||
| 
 | ||||
| ## Errors on pushing to registry | ||||
| * [`auto-push is currently not implemented for docker driver`](#auto-push-is-currently-not-implemented-for-docker-driver) | ||||
| * [Cannot push to a registry](#cannot-push-to-a-registry) | ||||
| 
 | ||||
| ## `auto-push is currently not implemented for docker driver` | ||||
| 
 | ||||
| If you're using the default builder (which uses the docker driver) without using our `setup-buildx-action`, you may | ||||
| encounter this error message if you try to push your image: | ||||
| 
 | ||||
| ``` | ||||
| Run docker/build-push-action@v2 | ||||
| 📣 Buildx version: 0.4.2 | ||||
| 🏃 Starting build... | ||||
| /usr/bin/docker buildx build --tag localhost:5000/name/app:latest --iidfile /tmp/docker-build-push-eYl8PB/iidfile --file ./test/Dockerfile --push ./test | ||||
| auto-push is currently not implemented for docker driver | ||||
| Error: buildx call failed with: auto-push is currently not implemented for docker driver | ||||
| ``` | ||||
| 
 | ||||
| While waiting for an implementation to be done on buildx/buildkit, you have the following possibilities | ||||
| to solve this atm: | ||||
| 
 | ||||
| ### With `docker-container` driver and `setup-buildx` | ||||
| 
 | ||||
| > Recommended solution | ||||
| 
 | ||||
| ```yaml | ||||
| jobs: | ||||
|   build: | ||||
|     - | ||||
|       name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|     - | ||||
|       name: Set up Docker Buildx | ||||
|       uses: docker/setup-buildx-action@v1 | ||||
|     - | ||||
|       name: Login | ||||
|       uses: docker/login-action@v1 | ||||
|       with: | ||||
|         registry: ${{ env.REGISTRY }} | ||||
|         username: ${{ env.USER }} | ||||
|         password: ${{ secrets.PASSWORD }} | ||||
|     - | ||||
|       name: Build and push | ||||
|       uses: docker/build-push-action@v2 | ||||
|       with: | ||||
|         context: . | ||||
|         tags: ${{ env.REGISTRY }}/myapp:latest | ||||
|         push: true | ||||
| ``` | ||||
| 
 | ||||
| ### With `docker` driver | ||||
| 
 | ||||
| ```yaml | ||||
| jobs: | ||||
|   build: | ||||
|     - | ||||
|       name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|     - | ||||
|       name: Login | ||||
|       uses: docker/login-action@v1 | ||||
|       with: | ||||
|         registry: ${{ env.REGISTRY }} | ||||
|         username: ${{ env.USER }} | ||||
|         password: ${{ secrets.PASSWORD }} | ||||
|     - | ||||
|       name: Build | ||||
|       uses: docker/build-push-action@v2 | ||||
|       with: | ||||
|         context: . | ||||
|         tags: ${{ env.REGISTRY }}/myapp:latest | ||||
|         load: true | ||||
|     - | ||||
|       name: Push | ||||
|       run: docker push ${{ env.REGISTRY }}/myapp:latest | ||||
| ``` | ||||
| 
 | ||||
| ### With `docker` driver and `setup-buildx` | ||||
| 
 | ||||
| ```yaml | ||||
| jobs: | ||||
|   build: | ||||
|     - | ||||
|       name: Checkout | ||||
|       uses: actions/checkout@v2 | ||||
|     - | ||||
|       name: Set up Docker Buildx | ||||
|       uses: docker/setup-buildx-action@v1 | ||||
|       with: | ||||
|         driver: docker | ||||
|     - | ||||
|       name: Login | ||||
|       uses: docker/login-action@v1 | ||||
|       with: | ||||
|         registry: ${{ env.REGISTRY }} | ||||
|         username: ${{ env.USER }} | ||||
|         password: ${{ secrets.PASSWORD }} | ||||
|     - | ||||
|       name: Build | ||||
|       uses: docker/build-push-action@v2 | ||||
|       with: | ||||
|         context: . | ||||
|         tags: ${{ env.REGISTRY }}/myapp:latest | ||||
|         load: true | ||||
|     - | ||||
|       name: Push | ||||
|       run: docker push ${{ env.REGISTRY }}/myapp:latest | ||||
| ``` | ||||
| 
 | ||||
| ## Cannot push to a registry | ||||
| 
 | ||||
| While pushing to a registry, you may encounter these kinds of issues: | ||||
| 
 | ||||
| @ -38,7 +146,7 @@ jobs: | ||||
|   containerd: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|        - | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - | ||||
|  | ||||
| @ -117,9 +117,11 @@ describe('parseVersion', () => { | ||||
| }); | ||||
| 
 | ||||
| describe('getSecret', () => { | ||||
|   it('writes correct secret content', async () => { | ||||
|     const key = 'MY_KEY'; | ||||
|     const secret = 'c3RyaW5nLXdpdGgtZXF1YWxzCg=='; | ||||
|   test.each([ | ||||
|     ['A_SECRET', 'abcdef0123456789'], | ||||
|     ['GIT_AUTH_TOKEN', 'abcdefghijklmno=0123456789'], | ||||
|     ['MY_KEY', 'c3RyaW5nLXdpdGgtZXF1YWxzCg=='] | ||||
|   ])('given %p key and %p secret', async (key, secret) => { | ||||
|     const secretArgs = await buildx.getSecret(`${key}=${secret}`); | ||||
|     console.log(`secretArgs: ${secretArgs}`); | ||||
|     expect(secretArgs).toEqual(`id=${key},src=${tmpNameSync}`); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user