Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
cc172af2
Commit
cc172af2
authored
Aug 21, 2015
by
Zach Loafman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13049 from mesosphere/mesos-docker-lazy-pull
[mesos/docker] Lazily pull images to speed up kube-up
parents
af83c8b4
47d3d856
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
util.sh
cluster/mesos/docker/util.sh
+20
-5
No files found.
cluster/mesos/docker/util.sh
View file @
cc172af2
...
...
@@ -56,6 +56,22 @@ function cluster::mesos::docker::docker_compose {
)
}
# Pull the images from a docker compose file, if they're not already cached.
# This avoid slow remote calls from `docker-compose pull` which delegates
# to `docker pull` which always hits the remote docker repo, even if the image
# is already cached.
function
cluster::mesos::docker::docker_compose_lazy_pull
{
for
img
in
$(
grep
'^\s*image:\s'
"
${
provider_root
}
/docker-compose.yml"
|
sed
's/[ \t]*image:[ \t]*//'
)
;
do
read
repo tag
<<<
$(
echo
"
${
img
}
"
|
sed
's/:/ /'
)
if
[
-z
"
${
tag
}
"
]
;
then
tag
=
"latest"
fi
if
!
docker images
"
${
repo
}
"
|
awk
'{print $2;}'
|
grep
-q
"
${
tag
}
"
;
then
docker pull
"
${
img
}
"
fi
done
}
# Run kubernetes scripts inside docker.
# This bypasses the need to set up network routing when running docker in a VM (e.g. boot2docker).
# Trap signals and kills the docker container for better signal handing
...
...
@@ -252,12 +268,11 @@ function kube-up {
mkdir
-p
"
${
log_dir
}
"
rm
-rf
"
${
log_dir
}
"
/
*
if
[
"
${
MESOS_DOCKER_SKIP_BUILD
:-
false
}
"
!=
"true"
]
;
then
# Pull before `docker-compose up` to avoid timeouts between container runs.
# Pull before building images (but only if built) to avoid overwriting locally built images.
echo
"Pulling docker images"
1>&2
cluster::mesos::docker::docker_compose pull
# Pull before `docker-compose up` to avoid timeouts caused by slow pulls during deployment.
echo
"Pulling Docker images"
1>&2
cluster::mesos::docker::docker_compose_lazy_pull
if
[
"
${
MESOS_DOCKER_SKIP_BUILD
:-
false
}
"
!=
"true"
]
;
then
echo
"Building Docker images"
1>&2
# TODO: version images (k8s version, git sha, and dirty state) to avoid re-building them every time.
"
${
provider_root
}
/km/build.sh"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment