My jenkins job getting error while pushing the docker image to docker hub

Hello ! I am fresher to this IT field. I am a student learning and trying to explore and learn. so i have installed Ubuntu in my window machine and now i have created a jenkins ac on my machine. while pushing the image with build step execute shell command my image is being created and jenkins job is successful.but when i use build step as docker build and publish i get error saying permission denied why? i have checked all my docker hub credentials multiple time it is 100% correct. i also have executed this command.

$ sudo usermod -aG docker jenkins

- Restart Jenkins
$ sudo systemctl restart jenkins
$ sudo chmod 777 /var/run/docker.sock

no luck so far. Any help will be great…

Never do this. That file is protected for a reason. Making accessible to everyone is a security risk as everyone with access to the docker socket basically has full root access to your host.

regarding your problem, a little context would be helpful. You shared that docker says “permission denied” but Docker always tells you what it wanted to access. Without that there is not much we can say. We also don’t know how you installed Jenkins. Is it running on the host or in a container?

The title of your question indicates you have problem with pushing the image but in the content you mention building and pushing and you change the docker socket which is always needed by Docker.

Please, always share the full error message and when you do that format your post according to this guide: How to format your forum posts

Hello! I might not know how a question should be posted. I will try to be accurate next time. The issue got resolved. I ran the job and it was successful.
Thank you so much for your response…