Cannot push docker image into docker hub from Github Action #24693
-
Hi All, I have yaml file in GitHub action and i have successfully build docker image in it and i want to push into docker hub but getting below error
Here is the yml file
Please do let me know where im wrong and what i miss |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
You need to tag the newly built image with the full Docker Hub name before pushing, e.g.:
|
Beta Was this translation helpful? Give feedback.
-
i have added like this
Job executed successfully but image doesn’t push into docker hub …i check docker hub it showing empty |
Beta Was this translation helpful? Give feedback.
-
You need to do both. Tag first, then push. |
Beta Was this translation helpful? Give feedback.
-
problem solve but i want to deploy container using that image in github action can u tell me how to do it …any links or steps will be great for me in doing |
Beta Was this translation helpful? Give feedback.
-
MohdRashid01:
What exactly you want to do and achieve? |
Beta Was this translation helpful? Give feedback.
-
i want to run that image as a docker container in github action …i already have deploy image in github action now want to run that image as container …thats my task |
Beta Was this translation helpful? Give feedback.
-
If you just want to run the container, you can do a If you want to keep the container running after the Actions workflow completes you need to do that elsewhere (e.g. with a hoster), how to start it there from Actions depends on where the “elsewhere” is. |
Beta Was this translation helpful? Give feedback.
-
Yes, i want my container to be running please give us any link or website or any command to do it…hoster i didnt understand it …if u r saying about VM deploy that also i can do it…just need commands or website |
Beta Was this translation helpful? Give feedback.
-
Consider using an action to build and push the image. It will be less error prone, it handles the login and any other post actions (logout). I find it easier to maitain:
|
Beta Was this translation helpful? Give feedback.
-
I have my "Dockerfile" present on the same branch where github actions is there. but still it is not able to locate the Dockerfile. here is the code part:
my Dockerfile is present in the same branch along with otherfiles. please suggest with the update code to consider correct dockerfile. |
Beta Was this translation helpful? Give feedback.
Consider using an action to build and push the image. It will be less error prone, it handles the login and any other post actions (logout). I find it easier to maitain:
name: push image to ghcr.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}