Removed extra init packages

Signed-off-by: French Ben <frenchben@docker.com>
This commit is contained in:
French Ben 2017-02-22 20:06:38 -08:00
parent e3d1349d3d
commit 18222c638d
4 changed files with 0 additions and 267 deletions

View File

@ -1,67 +0,0 @@
#!/sbin/openrc-run
description="Bootstrap procedure if running on Docker for AWS"
depend()
{
need docker
}
start()
{
[ "$(mobyplatform)" != "aws" ] && exit 0
ebegin "Running AWS-specific initialization"
INSTANCE_DATA_ENDPOINT=http://169.254.169.254/latest
METADATA="${INSTANCE_DATA_ENDPOINT}/meta-data"
USERDATA="${INSTANCE_DATA_ENDPOINT}/user-data"
USER_SSH_DIR=/home/docker/.ssh
# setup SSH keys
if [ ! -d ${USER_SSH_DIR} ]
then
mkdir -p ${USER_SSH_DIR}
chmod 700 ${USER_SSH_DIR}
fi
# Put instance SSH key in place.
wget -q -O /tmp/my-key ${METADATA}/public-keys/0/openssh-key &>/dev/null
if [ $? -eq 0 ]
then
cat /tmp/my-key >> ${USER_SSH_DIR}/authorized_keys
chmod 700 ${USER_SSH_DIR}/authorized_keys
rm /tmp/my-key
else
echo "No SSH public key found to add to instance"
fi
# TODO: The docker user should be given more permissions on FS by
# default, this is temporary hack
chown -R docker /home/docker
chgrp -R docker /home/docker
chown -R docker /var/log
chgrp -R docker /var/log
passwd -u docker
HOSTNAME=$(wget -qO- ${METADATA}/local-hostname)
# Set hostname based on what AWS tells us it should be.
echo ${HOSTNAME} >/etc/hostname
hostname -F /etc/hostname
# Needed for ELB integration.
mkdir -p /var/lib/docker/swarm
# Get user data file and use it to bootstrap Moby in the cloud
wget -q -O /tmp/user-data ${USERDATA}/
# For now we will have a shell script which executes on boot.
# TODO(nathanleclaire/kencochrane): Migrate this to mobyconfig, or similar.
if [ $? -eq 0 ]
then
sh /tmp/user-data
fi
eend 0
}

View File

@ -1,131 +0,0 @@
#!/sbin/openrc-run
description="Bootstrap procedure if running on Docker Azure edition"
depend()
{
need docker
need net
}
start()
{
[ "$(mobyplatform)" != "azure" ] && exit 0
ebegin "Running Azure-specific initialization"
for i in $(seq 1 20)
do
einfo "Pulling Windows Azure Linux Agent container"
docker pull docker4x/agent-azure >/dev/null
if [ $? -eq 0 ]
then
break
fi
# Wait for... network to come up? DNS servers to be reachable?
# Not certain, but Azure continually fails to achieve this pull so
# far because it can't dial the DNS lookup properly.
#
# TODO: Debug.
sleep 5
done
einfo "Running Windows Azure Linux Agent container"
export DOCKER_FOR_IAAS_VERSION="azure-v1.13.1-ga-2"
export DOCKER_FOR_IAAS_VERSION_DIGEST="badffbf8fff6fb1bdf05ec485b52ae15d80f6e23c6b3ba0e89abd80fb932bd84"
# "Fake" /etc/hostname setup for persistence across reboots
#
# Note the bind mount in 'docker run' below.
if [ ! -d /var/etc/ ]
then
mkdir -p /var/etc
fi
if [ ! -d /var/home/docker ]
then
mkdir -p /var/home/docker
chown -R docker:docker /var/home/docker
fi
if [ ! -f /var/etc/hostname ]
then
echo "moby" >/var/etc/hostname
fi
if [ -f /var/lib/waagent/provisioned ]
then
# During provisioning, the Azure agent usually does this, but
# on reboots, it will need to be invoked "manually".
hostname -F /var/etc/hostname
kill -HUP "$(pidof dhcpcd)"
fi
docker run -d \
--privileged \
--name agent \
--ipc host \
--pid host \
--net host \
--uts host \
--label com.docker.editions.system \
--restart unless-stopped \
-e DOCKER_FOR_IAAS_VERSION \
-v /usr/bin/docker:/usr/local/bin/docker:ro \
-v /mnt:/mnt \
-v /etc:/etc \
-v /var/etc/ssh:/etc/ssh \
-v /var/etc/hostname:/etc/hostname \
-v /var/home:/home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/log:/var/log \
-v /lib/modules:/lib/modules \
-v /lib/firmware:/lib/firmware \
-v /var/lib/waagent:/var/lib/waagent \
"docker4x/agent-azure@sha256:$DOCKER_FOR_IAAS_VERSION_DIGEST"
# Wait for docker user to be added by agent.
while [ ! -d /home/docker ]
do
sleep 5
done
# TODO: Make this cleaner.
# User gets added by waagent.
# Need to unlock it to login via SSH.
passwd -u docker
checkpath --directory --mode 0700 /home/docker/.ssh
# Wait for WALinux agent provisioning to finish before invoking the
# passed custom data. This assures us that hostname etc. is set
# correctly before running, say, swarm commmands.
while [ ! -f /var/lib/waagent/provisioned ]
do
sleep 5
done
cat <<EOF >/etc/docker/daemon.json
{
"log-driver": "syslog",
"log-opts": {
"syslog-address": "udp://localhost:514",
"tag": "{{.Name}}/{{.ID}}"
}
}
EOF
# Ensure correct hostname according to Azure and reload daemon config
service docker restart
. /var/lib/waagent/CustomData
eend 0
}
stop()
{
[ "$(mobyplatform)" != "azure" ] && exit 0
docker rm -f agent || true
passwd -l docker
}

View File

@ -1,29 +0,0 @@
#!/sbin/openrc-run
description="Set hostname on Docker GCP edition"
depend()
{
need net
before docker
}
metadata() {
curl -sH 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/${1}
}
start()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Set hostname based on what GCP tells us it should be"
IP=$(metadata instance/network-interfaces/0/ip)
HOSTNAME=$(metadata instance/hostname)
echo "${IP} ${HOSTNAME} ${HOSTNAME%%.*} # Added by Google" >> /etc/hosts
echo "169.254.169.254 metadata.google.internal # Added by Google" >> /etc/hosts
echo ${HOSTNAME%%.*} >/etc/hostname
hostname -F /etc/hostname
eend 0
}

View File

@ -1,40 +0,0 @@
#!/sbin/openrc-run
description="Run startup/shudown scripts on Docker GCP edition"
depend()
{
need net
}
metadata() {
curl -sfH 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/${1}
}
start()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Run startup script"
temp_file=$(mktemp)
metadata /instance/attributes/startup-script > ${temp_file}
[ -s "${temp_file}" ] && sh "${temp_file}"
rm -f "${temp_file}"
eend 0
}
stop()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Run shutdown script"
temp_file=$(mktemp)
metadata /instance/attributes/shutdown-script > ${temp_file}
[ -s "${temp_file}" ] && sh "${temp_file}"
rm -f "${temp_file}"
eend 0
}