Specific init.d script for GCP

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot 2016-12-22 16:01:40 +01:00
parent 86c29efe87
commit a54f2ae179
4 changed files with 35 additions and 0 deletions

View File

@ -57,6 +57,7 @@ RUN \
rc-update add containerd default && \
rc-update add aws default && \
rc-update add azure default && \
rc-update add gcp default && \
true
CMD ["/mkinitrd.sh"]

View File

@ -49,6 +49,7 @@ moby.img: Dockerfile mkinitrd.sh init $(ETCFILES)
-C packages/containerd etc -C ../.. \
-C packages/aws etc -C ../.. \
-C packages/azure etc -C ../.. \
-C packages/gcp etc -C ../.. \
| \
docker build -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
echo $$BUILD > mobylinux.tag && \

View File

@ -86,6 +86,10 @@ start()
cat /etc/docker/daemon.json | jq -e 'has("experimental")' > /dev/null || DOCKER_OPTS="${DOCKER_OPTS} --experimental"
fi
# On GCP, send logs to Google Cloud Logging
# Disabled because of https://github.com/docker/docker/issues/29344
# [ $(mobyplatform) = "gcp" ] && DOCKER_OPTS="${DOCKER_OPTS} --log-driver=gcplogs"
# choose storage driver
if ! $(cat /etc/docker/daemon.json | jq -e '."storage-driver"' > /dev/null)
then

View File

@ -0,0 +1,29 @@
#!/sbin/openrc-run
description="Bootstrap procedure if running on Docker GCP edition"
depend()
{
need docker
need net
}
start()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Running GCP-specific initialization"
ebegin "Run startup script"
temp_file=$(mktemp)
curl -s http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script -H "Metadata-Flavor: Google" > ${temp_file}
[ -s "${temp_file}" ] && sh "${temp_file}"
rm -f "${temp_file}"
eend 0
}
stop()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
}