Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 500c202

Browse files
committed
pull git source volume if reloading
Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent 90cf37a commit 500c202

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

api/client/run.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ func (cli *DockerCli) initSpecialVolumes(config *container.Config, hostConfig *c
177177
volType := checkSourceType(vol.Source)
178178
switch volType {
179179
case "git":
180-
cmd = append(cmd, "git", "clone", vol.Source, INIT_VOLUME_PATH+vol.Destination)
180+
// Only need to clone for the very first time volume gets initialized
181+
if config.Image != "" {
182+
cmd = append(cmd, "git", "clone", vol.Source, INIT_VOLUME_PATH+vol.Destination)
183+
} else {
184+
cmd = append(cmd, "sh", "-c", "cd", INIT_VOLUME_PATH+vol.Destination, ";git", "pull")
185+
}
181186
case "http":
182187
parts := strings.Split(vol.Source, "/")
183188
cmd = append(cmd, "wget", "--no-check-certificate", "--tries=5", "--mirror", "--no-host-directories", "--cut-dirs="+strconv.Itoa(len(parts)), vol.Source, "--directory-prefix="+INIT_VOLUME_PATH+vol.Destination)

0 commit comments

Comments
 (0)