- Build fails when using [Docker Build and Publish plugin] to push to a public registry like DockerHub.
- Error message: Do you really want to push to public registry?EOF
- CloudBees Jenkins Enterprise
- Docker shipped with Red Hat Enterprise Linux 7.1+
In Red Hat Enterprise Linux 7.1, experimental features have been introduced in the Docker package that is shipped within the distribution. It includes options to manage which registries the docker daemon can connect to. More information can be found in this article: Understanding the Changes to ???docker search??? and ???docker pull??? in Red Hat Enterprise Linux 7.1.
In particular, there is an option
--confirm-def-push, which makes Docker ask for a confirmation before pushing to a public registry. The default value is true.
When trying to push a docker image to a public registry, the user is prompted with the following message: Do you really want to push to public registry?. This prompt makes the build fail when using the [Docker Build and Publish plugin]:
Do you really want to push to public registry? [y/n]: EOF Build step 'Docker Build and Publish' marked build as failure
In order to fix this, you need to configure the docker daemon. Add the option
--confirm-def-push=false to the
OPTIONS variable when starting the docker daemon. The simplest way is to edit the
OPTIONS vaiable in the docker configuration file
/etc/sysconfig/docker. If the configuration file does not exists, create it and add the following:
More information about how to configure docker can be found at https://docs.docker.com/engine/articles/configuring/#configuring-docker.