Skip to content

GitLab CI Kotlin DSLopensavvy.gitlab.ci.pluginsDocker

Docker

class Docker

Integrate Docker into your build.

This plugin is responsible for adding the docker extension to scripts:

val dockerBuild by job {
    useDockerInDocker()
    useContainerRegistry()

    script {
        docker.build("backend")
    }
}

This plugin uses Docker in Docker, which can create security vulnerabilities. To build containers without using Docker in Docker, see the Kaniko plugin.

Job extensions

This plugin provides the following job extensions:

Types

Companion

object Companion

Functions

build

fun build(image: String, version: String = defaultVersion, dockerfile: String = "Dockerfile", context: String = ".", previousVersions: List<String> = listOf("latest")): ERROR CLASS: Unresolved name: with

Builds a Docker image from a Dockerfile.

logInToRegistry

fun logInToRegistry(registry: String, username: String, password: String): ERROR CLASS: Unresolved name: with

Logs in to an arbitrary container registry.

pull

fun pull(image: String, version: String = "latest", allowFailure: Boolean = false): ERROR CLASS: Unresolved name: with

Pulls a given image's version.

push

fun push(image: String, version: String = defaultVersion): ERROR CLASS: Unresolved name: with

Pushes the image to a container registry.

rename

fun rename(image: String, oldVersion: String = defaultVersion, newVersion: String = "latest"): ERROR CLASS: Unresolved name: with

Renames a version of an image.