26min

Docker Push

Build and push image to a remote Docker registry.

Docker Push step uses Docker registries connected within Microtica Portal to obtain access credentials. If a specific registry name is not provided the default one will be used.

Registry credentials

Credentials for the specified remote Docker registry will be automatically provided by Microtica.

Syntax

microtica.yaml
|

Parameter

Description

Required

title
The display name of the step.
No
type
The type of the Microtica built-in step. Should always be docker-push for this type of step.
Yes
image_name
The name of the image that will be created and pushed in the remote Docker registry. When specifying the image name make sure that it is aligned with registry provider naming conventions, otherwise the pipeline execution will fail.
Yes
tag
The tag identifier for the image being pushed. Default: latest
No
dockerfile
Path to the Dockerfile to be used to build the image. Default: ./Dockerfile
No
registry
The name identifier of the Docker registry within Microtica. Default: default registry from the Microtica Portal
No
build_context
Path to the context for the Docker build command. Default: . docker build -t <image_name> .
No
build_arguments
Arguments to be applied in docker build command.
No
scan
Enable image vulnerability scanning. Default: true
No

Build and push an image

In the following example we define a pipeline that pulls the code from a Git repository then builds and pushes an image on Docker registry with the name dockerhub.

The image pushed on the remote registry will be named as my-app and tagged with v0.1.0.

microtica.yaml
|

Custom Dockerfile path and build context

The following example extends the previous one by adding custom path to the Dockerfile. In addition, we have to set the Docker build context to make sure that build command will run in context of app/build path.

microtica.yaml
|

Docker build arguments

If you need to provide additional arguments during Docker build-time you can do that by specifying the arguments in build_arguments step property. The arguments will be simply applied in the docker build command.

microtica.yaml
|

The build arguments can then be used in the Dockerfile file:

Dockerfile
|

Using local variables

You may also use the --build-arg flag without a value, in which case the value from the local environment will be propagated into the Docker container being built.

Arguments lifetime

Arguments allow you to pass the build-time variables that are accessed like regular environment variables in the RUN instruction of the Dockerfile. Also, these values don’t persist in the intermediate or final images like ENV values do.

ÔĽŅ

You must add --build-arg for each build argument.

ÔĽŅ

Updated 07 Jun 2022
Did this page help?
Yes
No