Docker¶
build_service(context, service)
¶
Build service image.
Source code in saritasa_invocations/docker.py
10 11 12 13 14 15 | |
buildpack(context, env='development', builder='', builder_env='', runner='', tag='', clear_cache=False)
¶
Build app image using buildpacks.
Source code in saritasa_invocations/docker.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
clear(context)
¶
Stop and remove all containers defined in docker-compose.
Also remove images.
Source code in saritasa_invocations/docker.py
236 237 238 239 240 241 242 243 244 245 246 | |
docker_compose_exec(context, service, command)
¶
Run exec using docker-compose.
docker compose exec
Used function so later it can be extended to use different docker-compose files.
context: Invoke context
service: Name of service to run command in
command: Command to run in service container
Source code in saritasa_invocations/docker.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
docker_compose_run(context, container, command, params='', watchers=(), env=None, **kwargs)
¶
Run command using docker-compose.
docker compose run
Used function so later it can be extended to use different docker-compose files.
context: Invoke context
params: Configuration params for docker compose
container: Name of container to start
command: Command to run in started container
watchers: Automated responders to command
env: environmental variables for run
kwargs: additional arguments for context.run
Source code in saritasa_invocations/docker.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
stop(context)
¶
Stop main containers.
Source code in saritasa_invocations/docker.py
226 227 228 229 230 231 232 233 | |
stop_all_containers(context)
¶
Shortcut for stopping ALL running docker containers.
Source code in saritasa_invocations/docker.py
115 116 117 118 | |
stop_containers(context, containers)
¶
Stop containers.
Source code in saritasa_invocations/docker.py
185 186 187 188 189 190 191 192 | |
up(context, quite_pull=False, quite_build=False, remove_orphans=True)
¶
Bring up main containers and start them.
Source code in saritasa_invocations/docker.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
up_containers(context, containers, detach=True, stop_others=True, quite_pull=False, quite_build=False, remove_orphans=True)
¶
Bring up containers and run them.
Add d kwarg to run them in background.
context: Invoke context
containers: Name of containers to start
detach: To run them in background
stop_others: Stop ALL other containers in case of errors during `up`.
Usually this happens when containers from other project uses the
same ports, for example, Postgres and redis.
quite_pull: Suppress the build output
quite_build: Pull without printing progress information
remove_orphans: Remove containers for services that are not in the
Compose file
UnexpectedExit: when `up` command wasn't successful
Source code in saritasa_invocations/docker.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |