Use Jenkins to build the Docker and use the Docker Build and Publish plug-in. After the program is compiled, enter Dockerfile to build Docker and report the error as follows:
[OppDocker] $ /usr/bin/docker build -t localhost:5000/oppdocker:57 --pull=true /var/lib/jenkins/workspace/OppDocker Sending build context to Docker daemon 644MB Step 1/7 : FROM openjdk:8-jre-alpine Get https://registry-1.docker.io/v2/library/openjdk/manifests/8-jre-alpine: unauthorized: incorrect username or password Build step 'Docker Build and Publish' marked build as failure Finished: FAILURE
However, there is no problem in using commands such as Dock Build-T locally, and there is no problem in using shell commands (also Dock Build commands) in Jenkins.
I would like to ask the great god docker how to solve this problem and what is its principle?
- Jenkins users are already in the Docker user group.
- Operating environment: Ubuntu 16.04
Just now I saw that it might be necessary to use docker login. I went to docker hub to register my account. I used the docker login command to enter the docker id and the corresponding password under the command line of this machine, but it is still not possible …
This has nothing to do with docker. Because jenkins used a low-privilege account to run the service, she naturally did not have the privilege to manage docker. If you want jenkins to manage docker, use
useradd -a -G docker jenkinsCommand to add jenkins users to docker