mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-08 09:57:05 +02:00
Add support for insecure docker registry (#131)
* Add support for insecure docker registry Using --insecure-skip-tls-verify Fixes #110 * Apply formatting
This commit is contained in:
@@ -32,7 +32,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func DoBuild(dockerfilePath, srcContext, destination, snapshotMode string) error {
|
||||
func DoBuild(dockerfilePath, srcContext, destination, snapshotMode string, dockerInsecureSkipTLSVerify bool) error {
|
||||
// Parse dockerfile and unpack base image to root
|
||||
d, err := ioutil.ReadFile(dockerfilePath)
|
||||
if err != nil {
|
||||
@@ -113,7 +113,7 @@ func DoBuild(dockerfilePath, srcContext, destination, snapshotMode string) error
|
||||
if err := setDefaultEnv(); err != nil {
|
||||
return err
|
||||
}
|
||||
return image.PushImage(sourceImage, destination)
|
||||
return image.PushImage(sourceImage, destination, dockerInsecureSkipTLSVerify)
|
||||
}
|
||||
|
||||
func getHasher(snapshotMode string) (func(string) (string, error), error) {
|
||||
|
||||
+3
-2
@@ -48,7 +48,7 @@ func NewSourceImage(srcImg string) (*img.MutableSource, error) {
|
||||
}
|
||||
|
||||
// PushImage pushes the final image
|
||||
func PushImage(ms *img.MutableSource, destImg string) error {
|
||||
func PushImage(ms *img.MutableSource, destImg string, dockerInsecureSkipTLSVerify bool) error {
|
||||
srcRef := &img.ProxyReference{
|
||||
ImageReference: nil,
|
||||
Src: ms,
|
||||
@@ -65,7 +65,8 @@ func PushImage(ms *img.MutableSource, destImg string) error {
|
||||
|
||||
opts := ©.Options{
|
||||
DestinationCtx: &types.SystemContext{
|
||||
DockerRegistryUserAgent: fmt.Sprintf("kaniko/executor-%s", version.Version()),
|
||||
DockerRegistryUserAgent: fmt.Sprintf("kaniko/executor-%s", version.Version()),
|
||||
DockerInsecureSkipTLSVerify: dockerInsecureSkipTLSVerify,
|
||||
},
|
||||
}
|
||||
return copy.Image(policyContext, destRef, srcRef, opts)
|
||||
|
||||
Reference in New Issue
Block a user