github.com/jaylevin/jenkins-library@v1.230.4/documentation/docs/steps/containerPushToRegistry.md (about)

     1  # ${docGenStepName}
     2  
     3  ## ${docGenDescription}
     4  
     5  ## Prerequisites
     6  
     7  You need to have a valid user with write permissions in the target docker registry.
     8  
     9  Credentials for the target docker registry have been configured in Jenkins with a dedicated Id.
    10  
    11  You can create the credentials in your Jenkins<br />
    12  via _Jenkins_ -> _Credentials_ -> _System_ -> _Global credentials (unrestricted)_ -> _Add Credentials_ ->
    13  
    14  * Kind: _Username with Password_
    15  * ID: specify id which you then use for the configuration of `dockerCredentialsId` (see below)
    16  
    17  ## Example
    18  
    19  Usage of pipeline step:
    20  
    21  **OPTION A:** To pull a Docker image from an existing docker registry and push to a different docker registry:
    22  
    23  ```groovy
    24  containerPushToRegistry script: this,
    25                          dockerCredentialsId: 'myTargetRegistryCredentials',
    26                          sourceRegistryUrl: 'https://mysourceRegistry.url',
    27                          sourceImage: 'path/to/mySourceImageWith:tag',
    28                          dockerRegistryUrl: 'https://my.target.docker.registry:50000'
    29  ```
    30  
    31  **OPTION B:** To push a locally built docker image into the target registry (only possible when a Docker daemon is available on your Jenkins node):
    32  
    33  ```groovy
    34  containerPushToRegistry script: this,
    35                          dockerCredentialsId: 'myTargetRegistryCredentials',
    36                          dockerImage: 'path/to/myImageWith:tag',
    37                          dockerRegistryUrl: 'https://my.target.docker.registry:50000'
    38  ```
    39  
    40  ## ${docGenParameters}
    41  
    42  ## ${docGenConfiguration}
    43  
    44  ## ${docJenkinsPluginDependencies}