@@ -51,6 +51,17 @@ func (wrapper *ComposeWrapper) Remove(ctx context.Context, workingDir, host, pro
51
51
return err
52
52
}
53
53
54
+ // Pull an image associated with a service defined in a docker-compose.yml or docker-stack.yml file,
55
+ // but does not start containers based on those images.
56
+ func (wrapper * ComposeWrapper ) Pull (ctx context.Context , workingDir , host , projectName string , filePaths []string ) error {
57
+ output , err := wrapper .Command (newPullCommand (filePaths ), workingDir , host , projectName , "" )
58
+ if len (output ) != 0 {
59
+ log .Printf ("[libstack,composebinary] [message: finish deploying] [output: %s] [err: %s]" , output , err )
60
+ }
61
+
62
+ return err
63
+ }
64
+
54
65
// Command executes a docker-compose command
55
66
func (wrapper * ComposeWrapper ) Command (command composeCommand , workingDir , host , projectName , envFilePath string ) ([]byte , error ) {
56
67
program := utils .ProgramPath (wrapper .binaryPath , "docker-compose" )
@@ -111,6 +122,10 @@ func newDownCommand(filePaths []string) composeCommand {
111
122
return newCommand ([]string {"down" , "--remove-orphans" }, filePaths )
112
123
}
113
124
125
+ func newPullCommand (filePaths []string ) composeCommand {
126
+ return newCommand ([]string {"pull" }, filePaths )
127
+ }
128
+
114
129
func (command * composeCommand ) WithProjectName (projectName string ) {
115
130
command .args = append (command .args , "-p" , projectName )
116
131
}
0 commit comments