diff --git a/common/build.go b/common/build.go
index e10f31c9d29a1f0564ba64540e98c3f70a159895..adb771752a45328efef070e5ad9e2e16b2635ca4 100644
--- a/common/build.go
+++ b/common/build.go
@@ -9,7 +9,9 @@ import (
 	"strconv"
 	"strings"
 
+	"encoding/base64"
 	"github.com/Sirupsen/logrus"
+	"github.com/dustin/gojson"
 	"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
 	"time"
 )
@@ -271,6 +273,28 @@ func (b *Build) String() string {
 	return helpers.ToYAML(b)
 }
 
+func (b *Build) GetDockerConfig() string {
+	config := &struct {
+		Authorizations map[string]interface{} `json:"auths"`
+	}{
+		Authorizations: make(map[string]interface{}),
+	}
+
+	for _, credential := range b.Credentials.GetByType(CredentialContainerRegistry) {
+		config.Authorizations[credential.ServerURL] = &struct {
+			Auth string `json:"auth"`
+		}{
+			Auth: credential.EncodeUserAndPassword(),
+		}
+	}
+
+	data, err := json.Marshal(config)
+	if err != nil {
+		return ""
+	}
+	return string(data)
+}
+
 func (b *Build) GetDefaultVariables() BuildVariables {
 	return BuildVariables{
 		{"CI", "true", true, true, false},
@@ -286,6 +310,7 @@ func (b *Build) GetDefaultVariables() BuildVariables {
 		{"CI_SERVER_NAME", "GitLab CI", true, true, false},
 		{"CI_SERVER_VERSION", "", true, true, false},
 		{"CI_SERVER_REVISION", "", true, true, false},
+		{"DOCKER_CONFIG", b.GetDockerConfig(), false, true, true},
 		{"GITLAB_CI", "true", true, true, false},
 	}
 }
diff --git a/common/network.go b/common/network.go
index 1f82d645acbb3be2cd8d500d30b9f0922c651f8d..60cdf9fe86e838eab78c6697547b7478997c550c 100644
--- a/common/network.go
+++ b/common/network.go
@@ -70,23 +70,24 @@ type BuildInfo struct {
 }
 
 type GetBuildResponse struct {
-	ID              int            `json:"id,omitempty"`
-	ProjectID       int            `json:"project_id,omitempty"`
-	Commands        string         `json:"commands,omitempty"`
-	RepoURL         string         `json:"repo_url,omitempty"`
-	Sha             string         `json:"sha,omitempty"`
-	RefName         string         `json:"ref,omitempty"`
-	BeforeSha       string         `json:"before_sha,omitempty"`
-	AllowGitFetch   bool           `json:"allow_git_fetch,omitempty"`
-	Timeout         int            `json:"timeout,omitempty"`
-	Variables       BuildVariables `json:"variables"`
-	Options         BuildOptions   `json:"options"`
-	Token           string         `json:"token"`
-	Name            string         `json:"name"`
-	Stage           string         `json:"stage"`
-	Tag             bool           `json:"tag"`
-	DependsOnBuilds []BuildInfo    `json:"depends_on_builds"`
-	TLSCAChain      string         `json:"-"`
+	ID              int              `json:"id,omitempty"`
+	ProjectID       int              `json:"project_id,omitempty"`
+	Commands        string           `json:"commands,omitempty"`
+	RepoURL         string           `json:"repo_url,omitempty"`
+	Sha             string           `json:"sha,omitempty"`
+	RefName         string           `json:"ref,omitempty"`
+	BeforeSha       string           `json:"before_sha,omitempty"`
+	AllowGitFetch   bool             `json:"allow_git_fetch,omitempty"`
+	Timeout         int              `json:"timeout,omitempty"`
+	Variables       BuildVariables   `json:"variables"`
+	Options         BuildOptions     `json:"options"`
+	Token           string           `json:"token"`
+	Name            string           `json:"name"`
+	Stage           string           `json:"stage"`
+	Tag             bool             `json:"tag"`
+	DependsOnBuilds []BuildInfo      `json:"depends_on_builds"`
+	Credentials     BuildCredentials `json:"credentials"`
+	TLSCAChain      string           `json:"-"`
 }
 
 type RegisterRunnerRequest struct {