add pinata modified boot2docker until replaced by real Moby

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2015-11-27 11:46:27 +00:00
parent 0fa1e68dc6
commit 5b99c08596
50 changed files with 6734 additions and 0 deletions

217
boot2docker/Dockerfile Normal file
View File

@ -0,0 +1,217 @@
FROM debian:jessie
RUN apt-get update && apt-get -y install unzip \
xz-utils \
curl \
bc \
git \
build-essential \
golang \
cpio \
gcc libc6 libc6-dev \
kmod \
squashfs-tools \
genisoimage \
xorriso \
syslinux \
isolinux \
automake \
pkg-config \
p7zip-full
# https://www.kernel.org/
ENV KERNEL_VERSION 4.1.10
# Fetch the kernel sources
RUN curl --retry 10 https://www.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-$KERNEL_VERSION.tar.xz | tar -C / -xJ && \
mv /linux-$KERNEL_VERSION /linux-kernel
# http://aufs.sourceforge.net/
ENV AUFS_REPO https://github.com/sfjro/aufs4-standalone
ENV AUFS_BRANCH aufs4.1
ENV AUFS_COMMIT 4912d6da07e3e24d7a8484e0e8a4c1315adbc8fd
# we use AUFS_COMMIT to get stronger repeatability guarantees
# Download AUFS and apply patches and files, then remove it
RUN git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /aufs-standalone && \
cd /aufs-standalone && \
git checkout -q "$AUFS_COMMIT" && \
cd /linux-kernel && \
cp -r /aufs-standalone/Documentation /linux-kernel && \
cp -r /aufs-standalone/fs /linux-kernel && \
cp -r /aufs-standalone/include/uapi/linux/aufs_type.h /linux-kernel/include/uapi/linux/ && \
set -e && for patch in \
/aufs-standalone/aufs*-kbuild.patch \
/aufs-standalone/aufs*-base.patch \
/aufs-standalone/aufs*-mmap.patch \
/aufs-standalone/aufs*-standalone.patch \
/aufs-standalone/aufs*-loopback.patch \
; do \
patch -p1 < "$patch"; \
done
COPY kernel_config /linux-kernel/.config
RUN jobs=$(nproc); \
cd /linux-kernel && \
make -j ${jobs} oldconfig && \
make -j ${jobs} bzImage && \
make -j ${jobs} modules
# The post kernel build process
ENV ROOTFS /rootfs
ENV TCL_REPO_BASE http://distro.ibiblio.org/tinycorelinux/6.x/x86_64
# Note that the ncurses is here explicitly so that top continues to work
ENV TCZ_DEPS iptables \
iproute2 \
openssh openssl \
tar \
gcc_libs \
ncurses \
acpid \
xz liblzma \
git expat2 libiconv libidn libgpg-error libgcrypt libssh2 \
nfs-utils tcp_wrappers portmap rpcbind libtirpc \
curl ntpclient \
procps glib2 libtirpc libffi fuse pcre \
udev-lib \
liblvm2 \
parted
# Make the ROOTFS
RUN mkdir -p $ROOTFS
# Prepare the build directory (/tmp/iso)
RUN mkdir -p /tmp/iso/boot
# Install the kernel modules in $ROOTFS
RUN cd /linux-kernel && \
make INSTALL_MOD_PATH=$ROOTFS modules_install firmware_install
# Remove useless kernel modules, based on unclejack/debian2docker
RUN cd $ROOTFS/lib/modules && \
rm -rf ./*/kernel/sound/* && \
rm -rf ./*/kernel/drivers/gpu/* && \
rm -rf ./*/kernel/drivers/infiniband/* && \
rm -rf ./*/kernel/drivers/isdn/* && \
rm -rf ./*/kernel/drivers/media/* && \
rm -rf ./*/kernel/drivers/staging/lustre/* && \
rm -rf ./*/kernel/drivers/staging/comedi/* && \
rm -rf ./*/kernel/fs/ocfs2/* && \
rm -rf ./*/kernel/net/bluetooth/* && \
rm -rf ./*/kernel/net/mac80211/* && \
rm -rf ./*/kernel/net/drivers/ethernet/* && \
rm -rf ./*/kernel/net/drivers/scsi/* && \
rm -rf ./*/kernel/net/drivers/mtd/* && \
rm -rf ./*/kernel/fs/btrfs/* && \
rm -rf ./*/kernel/fs/xfs/* && \
rm -rf ./*/kernel/net/wireless/*
# Install libcap
RUN curl -fL http://http.debian.net/debian/pool/main/libc/libcap2/libcap2_2.22.orig.tar.gz | tar -C / -xz && \
cd /libcap-2.22 && \
sed -i 's/LIBATTR := yes/LIBATTR := no/' Make.Rules && \
make && \
mkdir -p output && \
make prefix=`pwd`/output install && \
mkdir -p $ROOTFS/usr/local/lib && \
cp -av `pwd`/output/lib64/* $ROOTFS/usr/local/lib
# Make sure the kernel headers are installed for aufs-util, and then build it
RUN cd /linux-kernel && \
make INSTALL_HDR_PATH=/tmp/kheaders headers_install && \
cd / && \
git clone https://github.com/Distrotech/aufs-util.git && \
cd /aufs-util && \
git checkout 5e0c348bd8b1898beb1e043b026bcb0e0c7b0d54 && \
CPPFLAGS="-I/tmp/kheaders/include" CLFAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \
DESTDIR=$ROOTFS make install && \
rm -rf /tmp/kheaders
# Prepare the ISO directory with the kernel
RUN cp -v /linux-kernel/arch/x86_64/boot/bzImage /tmp/iso/boot/vmlinuz64
# Download the rootfs, don't unpack it though:
RUN curl -fL -o /tcl_rootfs.gz $TCL_REPO_BASE/release/distribution_files/rootfs64.gz
# Install the TCZ dependencies
RUN for dep in $TCZ_DEPS; do \
echo "Download $TCL_REPO_BASE/tcz/$dep.tcz" &&\
curl -fL -o /tmp/$dep.tcz $TCL_REPO_BASE/tcz/$dep.tcz && \
unsquashfs -f -d $ROOTFS /tmp/$dep.tcz && \
rm -f /tmp/$dep.tcz ;\
done
# Make sure that all the modules we might have added are recognized (especially VBox guest additions)
RUN depmod -a -b $ROOTFS $KERNEL_VERSION-boot2docker
COPY VERSION $ROOTFS/etc/version
RUN cp -v $ROOTFS/etc/version /tmp/iso/version
# Get the Docker version that matches our boot2docker version
# Note: `docker version` returns non-true when there is no server to ask
RUN curl -fL -o $ROOTFS/usr/local/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-$(cat $ROOTFS/etc/version) && \
chmod +x $ROOTFS/usr/local/bin/docker && \
{ $ROOTFS/usr/local/bin/docker version || true; }
# .git directory is not available because it's in ../..
RUN echo "pinata: unknown-sha %(date)" > $ROOTFS/etc/boot2docker
# Install Tiny Core Linux rootfs
RUN cd $ROOTFS && zcat /tcl_rootfs.gz | cpio -f -i -H newc -d --no-absolute-filenames
# Copy our custom rootfs
COPY rootfs/rootfs $ROOTFS
# setup acpi config dir &
# tcl6's sshd is compiled without `/usr/local/sbin` in the path
# Boot2Docker and Docker Machine need `ip`, so I'm linking it in here
RUN cd $ROOTFS \
&& ln -s /usr/local/etc/acpi etc/ \
&& ln -s /usr/local/sbin/ip usr/sbin/
# These steps can only be run once, so can't be in make_iso.sh (which can be run in chained Dockerfiles)
# see https://github.com/boot2docker/boot2docker/blob/master/doc/BUILD.md
# Make sure init scripts are executable
RUN find $ROOTFS/etc/rc.d/ $ROOTFS/usr/local/etc/init.d/ -exec chmod +x '{}' ';'
# move dhcp.sh out of init.d as we're triggering it manually so its ready a bit faster
RUN mv $ROOTFS/etc/init.d/dhcp.sh $ROOTFS/etc/rc.d/
# Change MOTD
RUN mv $ROOTFS/usr/local/etc/motd $ROOTFS/etc/motd
# Make sure we have the correct bootsync
RUN mv $ROOTFS/boot*.sh $ROOTFS/opt/ && \
chmod +x $ROOTFS/opt/*.sh
# Make sure we have the correct shutdown
RUN mv $ROOTFS/shutdown.sh $ROOTFS/opt/shutdown.sh && \
chmod +x $ROOTFS/opt/shutdown.sh
# Add serial console
RUN echo "#!/bin/sh" > $ROOTFS/usr/local/bin/autologin && \
echo "/bin/login -f docker" >> $ROOTFS/usr/local/bin/autologin && \
chmod 755 $ROOTFS/usr/local/bin/autologin && \
echo 'ttyS0:2345:respawn:/sbin/getty -l /usr/local/bin/autologin 9600 ttyS0 vt100' >> $ROOTFS/etc/inittab && \
echo 'ttyS1:2345:respawn:/sbin/getty -l /usr/local/bin/autologin 9600 ttyS1 vt100' >> $ROOTFS/etc/inittab
# fix "su -"
RUN echo root > $ROOTFS/etc/sysconfig/superuser
# crontab
COPY rootfs/crontab $ROOTFS/var/spool/cron/crontabs/root
# avahi
# RUN apt-get install -y openssh-server avahi-daemon
# RUN echo "UseDNS no" >> /etc/ssh/sshd_config
# Copy boot params
COPY rootfs/isolinux /tmp/iso/boot/isolinux
COPY rootfs/make_iso.sh /
RUN /make_iso.sh

View File

@ -0,0 +1,15 @@
FROM boot2docker/boot2docker
MAINTAINER Sven Dowideit "SvenDowideit@docker.com"
#DESCRIPTION use the latest experimental build of Docker
#get the latest experimental docker
RUN curl -fL -o $ROOTFS/usr/local/bin/docker https://experimental.docker.com/builds/Linux/x86_64/docker-latest && \
chmod +x $ROOTFS/usr/local/bin/docker
RUN echo "" >> $ROOTFS/etc/motd
RUN echo " WARNING: this is an experimental.docker.com build, not a release." >> $ROOTFS/etc/motd
RUN echo "" >> $ROOTFS/etc/motd
RUN /make_iso.sh
CMD ["cat", "boot2docker.iso"]

191
boot2docker/LICENSE Normal file
View File

@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2014 Docker, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4
boot2docker/MAINTAINERS Normal file
View File

@ -0,0 +1,4 @@
Steeve Morin <steeve.morin@gmail.com> (@steeve)
Sven Dowideit <sven.dowideit@docker.com> (@SvenDowideit)
Tianon Gravi <admwiggin@gmail.com> (@tianon)
Michael Crosby <michael@crosbymichael.com> (@crosbymichael)

12
boot2docker/Makefile Normal file
View File

@ -0,0 +1,12 @@
DOCKER?=docker
.PHONY: build
build: VERSION
$(shell cd ../cmd/9pudc && GOOS=linux GOARCH=386 go build)
cp ../cmd/9pudc/9pudc rootfs/rootfs/sbin/9pudc
$(DOCKER) build -t boot2docker:test .
$(DOCKER) run boot2docker:test tar -C /tmp/iso/boot -c . | tar -xv
.PHONY: VERSION
VERSION:
docker -v | cut -f 3 -d ' ' | cut -f 1 -d ',' > VERSION

379
boot2docker/README.md Normal file
View File

@ -0,0 +1,379 @@
# Boot2Docker
Boot2Docker is a lightweight Linux distribution made specifically to run
[Docker](https://www.docker.com/) containers. It runs completely from RAM, is a
small ~24MB download and boots in ~5s (YMMV).
## Features
* Kernel 4.1.10 with AUFS, Docker v1.8.2 - using libcontainer
* Container persistence via disk automount on `/var/lib/docker`
* SSH keys persistence via disk automount
> **Note:** Boot2Docker uses port **2376**, the [registered IANA Docker SSL
> port](http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=docker)
## Caveat Emptor
Boot2Docker is currently designed and tuned for development. Using it for
any kind of production workloads at this time is highly discouraged.
## Installation
Installation instructions for [OS X](https://docs.docker.com/installation/mac/)
and [Windows](https://docs.docker.com/installation/windows/) are available on
the Docker documentation site.
The [ISO can be downloaded
here](https://github.com/boot2docker/boot2docker/releases).
### All in one Installers for OS X and Windows
We have built installers for [OS
X](https://github.com/boot2docker/osx-installer/releases) and
[Windows](https://github.com/boot2docker/windows-installer/releases) which will
install the `boot2docker` management tool, VirtualBox, and any tools needed to
run Boot2Docker.
### Installation using the `boot2docker` management tool
If you have the prerequisites, or want to help develop Boot2Docker, you can also
download the appropriate [boot2docker management
release](https://github.com/boot2docker/boot2docker-cli/releases) and use it to
download
[`boot2docker.iso`](https://github.com/boot2docker/boot2docker/releases).
## How to use
The `boot2docker` management tool leverages VirtualBox's `VBoxManage` to
initialise, start, stop and delete the VM right from the command line.
#### Initialize
```console
$ boot2docker init
```
#### Start VM
```console
$ boot2docker up
```
#### Upgrade the Boot2docker VM image
```console
$ boot2docker stop
$ boot2docker download
$ boot2docker up
```
If your Boot2Docker virtual machine was created prior to 0.11.1-pre1, it's best
to delete - `boot2docker delete` and then `boot2docker init` to create a new
VM.
The main changes are to add a `/var/lib/boot2docker/userdata.tar` file that is
un-tarred into the `/home/docker` directory on boot. This file contains a
`.ssh/authorized_keys` and `.ssh/authorized_keys2` files containing a public
SSH key.
## Docker Hub
To save and share container images, automate workflows, and more sign-up for a
free [Docker Hub account](https://hub.docker.com).
## More information
See [Frequently asked questions](doc/FAQ.md) for more details.
#### Boot script log
The bootup script output is logged to `/boot.log`, so you can see (and
potentially debug) what happens. Note that this is not persistent between boots
because we're logging from before the persistence partition is mounted (and it
may not exist at all).
#### Container Port redirection
The latest version of `boot2docker` sets up two network adaptors, one using NAT
to allow the VM to download images and files from the internet, and a host only
network that Docker container's ports will be exposed on.
If you run a container with an exposed port, and then use OSX's `open` command:
```console
$ boot2docker up
$ eval "$(boot2docker shellinit)"
$ docker run --name nginx-test -d -p 80:80 nginx
$ open http://$(boot2docker ip 2>/dev/null)/
$ docker stop nginx-test
$ docker rm nginx-test
```
The `eval "$(boot2docker shellinit)"` sets the `DOCKER_HOST` environment variable for
this shell, then the `docker run` starts the webserver as a daemon, and `open`
will then show the default page in your default web browser (using `boot2docker
ip`).
If you want to share container ports with other computers on your LAN, you will
need to set up [NAT adaptor based port forwarding](doc/WORKAROUNDS.md).
#### Docker daemon options
If you need to customize the options used to start the Docker daemon, you can
do so by adding entries to the `/var/lib/boot2docker/profile` file on the
persistent partition inside the Boot2Docker virtual machine. Then restart the
daemon.
The following example will enable core dumps inside containers, but you can
specify any other options you may need.
```console
boot2docker ssh -t sudo vi /var/lib/boot2docker/profile
# Add something like:
# EXTRA_ARGS="--default-ulimit core=-1"
boot2docker restart
```
#### TLS support
By default, `boot2docker` runs `docker` with TLS enabled. It auto-generates
certificates and stores them in `/home/docker/.docker` inside the VM. The
`boot2docker up` command will copy them to `~/.boot2docker/certs` on the
host machine once the VM has started, and output the correct values for
the `DOCKER_CERT_PATH` and `DOCKER_TLS_VERIFY` environment variables.
`eval "$(boot2docker shellinit)"` will also set them correctly.
We strongly recommend against running Boot2Docker with an unencrypted Docker
socket for security reasons, but if you have tools that cannot be easily
switched, you can disable it by adding `DOCKER_TLS=no` to your
`/var/lib/boot2docker/profile` file.
#### Folder sharing
Boot2Docker is essentially a remote Docker engine with a read only filesystem
(other than Docker images, containers and volumes). The most scalable and
portable way to share disk space between your local desktop and a Docker
container is by creating a volume container and then sharing that to where it's
needed.
One well tested approach is to use a file sharing container like
`svendowideit/samba`:
```console
$ # Make a volume container (only need to do this once)
$ docker run -v /data --name my-data busybox true
$ # Share it using Samba (Windows file sharing)
$ docker run --rm -v /usr/local/bin/docker:/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba my-data
$ # then find out the IP address of your Boot2Docker host
$ boot2docker ip
192.168.59.103
```
Connect to the shared folder using Finder (OS X):
Connect to cifs://192.168.59.103/data
Once mounted, will appear as /Volumes/data
Or on Windows, use Explorer to Connect to:
\\192.168.59.103\data
You can then use your data container from any container you like:
```console
$ docker run -it --volumes-from my-data ubuntu
```
You will find the "data" volume mounted as "/data" in that container. Note that
"my-data" is the name of volume container, this is shared via the "network" by
the "samba" container that refers to it by name. So, in this example, if you
were on OS-X you now have /Volumes/data and /data in container being shared. You
can change the paths as needed.
##### VirtualBox Guest Additions
Alternatively, Boot2Docker includes the VirtualBox Guest Additions built in for
the express purpose of using VirtualBox folder sharing.
The first of the following share names that exists (if any) will be
automatically mounted at the location specified:
1. `Users` share at `/Users`
2. `/Users` share at `/Users`
3. `c/Users` share at `/c/Users`
4. `/c/Users` share at `/c/Users`
5. `c:/Users` share at `/c/Users`
If some other path or share is desired, it can be mounted at run time by doing
something like:
```console
$ mount -t vboxsf -o uid=1000,gid=50 your-other-share-name /some/mount/location
```
It is also important to note that in the future, the plan is to have any share
which is created in VirtualBox with the "automount" flag turned on be mounted
during boot at the directory of the share name (ie, a share named `home/jsmith`
would be automounted at `/home/jsmith`).
In case it isn't already clear, the Linux host support here is currently hazy.
You can share your `/home` or `/home/jsmith` directory as `Users` or one of the
other supported automount locations listed above, but note that you will then
need to manually convert your `docker run -v /home/...:...` bind-mount host
paths accordingly (ie, `docker run -v /Users/...:...`). As noted in the
previous paragraph however, this is likely to change in the future as soon as a
more suitable/scalable solution is found and implemented.
#### Installing secure Registry certificates
You can add your Registry server's public certificate (in `.pem` format) into
the `/var/lib/boot2docker/certs/` directory, and Boot2Docker will automatically
load it from the persistence partition at boot.
You may need to add several certificates (as separate `.pem` files) to this
directory, depending on the CA signing chain used for your certificate.
##### Insecure Registry
As of Docker version 1.3.1, if your registry doesn't support HTTPS, you must add it as an
insecure registry.
```console
$ boot2docker init
$ boot2docker up
$ boot2docker ssh "echo $'EXTRA_ARGS=\"--insecure-registry <YOUR INSECURE HOST>\"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"
```
then you should be able to do a docker push/pull.
#### Running behind a VPN (Cisco AnyConnect, etc)
So sometimes if you are behind a VPN, you'll get an `i/o timeout` error.
The current work around is to forward the port in the boot2docker-vm.
If you get an error like the following:
```no-highlight
Sending build context to Docker daemon
2014/11/19 13:53:33 Post https://192.168.59.103:2376/v1.15/build?rm=1&t=your-tag: dial tcp 192.168.59.103:2376: i/o timeout
```
That means you have to forward port `2376`, which can be done like so:
* Open VirtualBox
* Open Settings > Network for your 'boot2docker-vm'
* Select the adapter that is 'Attached To': 'NAT' and click 'Port Forwarding'.
* Add a new rule:
- Protocol: TCP
- Host IP: 127.0.0.1
- Host Port: 5555
- Guest Port: 2376
* Set `DOCKER_HOST` to 'tcp://127.0.0.1:5555'
#### Customize
The `boot2docker` management tool allows you to customise many options from both
the command line, or by setting them in its configuration file.
See `boot2docker config` for more (including the format of the configuration
file).
#### SSH into VM
```console
$ boot2docker ssh
```
`boot2docker` auto logs in using the generated SSH key, but if you want to SSH
into the machine manually (or you're not using a `boot2docker` managed VM), the
credentials are:
```
user: docker
pass: tcuser
```
#### Persist data
Boot2docker uses [Tiny Core Linux](http://tinycorelinux.net), which runs from
RAM and so does not persist filesystem changes by default.
When you run `boot2docker init`, the `boot2docker` tool auto-creates a disk that
will be automounted and used to persist your docker data in `/var/lib/docker`
and `/var/lib/boot2docker`. This virtual disk will be removed when you run
`boot2docker delete`. It will also persist the SSH keys of the machine.
Changes outside of these directories will be lost after powering down or
restarting the VM - to make permanent modifications see the
[FAQ](doc/FAQ.md#local-customisation-with-persistent-partition).
If you are not using the `boot2docker` management tool, you can create an `ext4`
or `btrfs` formatted partition with the label `boot2docker-data` (`mkfs.ext4 -L
boot2docker-data /dev/sdX5`) to your VM or host, and Boot2Docker will automount
it on `/mnt/sdX` and then softlink `/mnt/sdX/var/lib/docker` to
`/var/lib/docker`.
#### Install on any device
To 'install' the ISO onto an SD card, USB-Stick or even empty hard disk, you can
use `dd if=boot2docker.iso of=/dev/sdX`. This will create the small boot
partition, and install an MBR.
#### Build your own Boot2Docker ISO
Goto [How to build](doc/BUILD.md) for Documentation on how to build your own
Boot2Docker ISOs.
## Troubleshooting
See the [workarounds doc](https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md) for solutions to known issues.
#### `boot2docker up` doesn't work (OSX)
Sometimes OSX will install updates that break VirtualBox and require a restart
of the kernel extensions that boot2docker needs in order to run. If you go to
boot boot2docker after some updates or a system restart and you get an output
such as the following:
```console
$ boot2docker up
error in run: Failed to start machine "boot2docker-vm" (run again with -v for details)
```
You may need to reload the kernel extensions in order to get your system
functioning again.
In this case, try running the following script (supplied with Virtual Box):
```console
$ sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart
```
You should see output such as:
```
/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart => /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl => /Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxDD2GC.gc => /Applications/VirtualBox.app/Contents/MacOS/VBoxDD2GC.gc-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxDDGC.gc => /Applications/VirtualBox.app/Contents/MacOS/VBoxDDGC.gc-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxExtPackHelperApp => /Applications/VirtualBox.app/Contents/MacOS/VBoxExtPackHelperApp-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless => /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage => /Applications/VirtualBox.app/Contents/MacOS/VBoxManage-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxNetAdpCtl => /Applications/VirtualBox.app/Contents/MacOS/VBoxNetAdpCtl-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxNetDHCP => /Applications/VirtualBox.app/Contents/MacOS/VBoxNetDHCP-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxNetNAT => /Applications/VirtualBox.app/Contents/MacOS/VBoxNetNAT-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxSVC => /Applications/VirtualBox.app/Contents/MacOS/VBoxSVC-amd64
/Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMIPCD => /Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMIPCD-amd64
/Applications/VirtualBox.app/Contents/MacOS/VMMGC.gc => /Applications/VirtualBox.app/Contents/MacOS/VMMGC.gc-amd64
/Applications/VirtualBox.app/Contents/MacOS/VirtualBox => /Applications/VirtualBox.app/Contents/MacOS/VirtualBox-amd64
/Applications/VirtualBox.app/Contents/MacOS/VirtualBoxVM => /Applications/VirtualBox.app/Contents/MacOS/VirtualBoxVM-amd64
/Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv => /Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv-amd64
Loading VBoxDrv.kext
Loading VBoxUSB.kext
Loading VBoxNetFlt.kext
Loading VBoxNetAdp.kext
```
Now the VM should boot properly.

View File

@ -0,0 +1,4 @@
/*
The Go port of boot2docker management script has been split into its own repo,
please visit https://github.com/boot2docker/boot2docker-cli.
*/

View File

@ -0,0 +1,49 @@
Automated script
===========
## Overview
The document describes the "automated script" functionality and some use cases. I assume
you have basic knowledge of iPxe/pxe booting. Please see the following link for more documentaion regarding iPxe:
http://ipxe.org/
## Summary
Automated script allows you to run an arbitrary script as a boot parameter. The script
parses `/proc/cmdline` for `script` variable and download the script if its either
an ftp or http uri. This method is used by Archlinux to install unattendedly. Please see the
following link for reference:
https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/root/.automated_script.sh
## Usecase
Lets say you want to run boot2docker on multiple physical machines and you want run hashicorp/consul
on all machines. You boot the machine via ipxe and add `script` as a parameter. The script you
use could take information from the host as an identifier and announce itself using that information.
## Extracting initrd and vmlinuz64
You mount the iso and the files are located in `/boot`.
## Extracting boot parameters
Extracting the parameters and adjusting these will help you boot and provision using iPxe. It will also
help you understand how boot2docker is being run currently.
```
root@896569876a97:/# cat /proc/cmdline
loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10:LABEL=boot2docker-data base initrd=/boot/initrd.img BOOT_IMAGE=/boot/vmlinuz64
```
## iPxe example
```
#!ipxe
set script http://192.168.3.3:4321/repo/script.sh
set append loglevel=3 user=docker console=ttyS0 console=tty nomodeset norestore base script=${script}
set kernel http://192.168.3.3:4321/repo/vmlinuz64
set initrd http://192.168.3.3:4321/repo/initrd.img
imgfree
kernel ${kernel} ${append}
initrd ${initrd}
boot
```

48
boot2docker/doc/BUILD.md Normal file
View File

@ -0,0 +1,48 @@
How to build boot2docker.iso locally
================================
The boot2docker.iso is built with Docker, via a Dockerfile.
During `docker build` we
* fetch, patch with AUFS support and build the 3.15.3 Linux Kernel with Tiny Core base configuration
* build the base rootfs for boot2docker (not complete)
* build the rootfs, download the latest Docker release and create the `.iso` file on `/` of the container.
Running the resultant image will cat the iso file to STDOUT.
So the full build process goes like this:
```console
# you will need more than 2GB memory
$ docker build -t boot2docker . && docker run --rm boot2docker > boot2docker.iso
```
Now you can install the iso to a USB drive, SD card, CD-Rom or hard-disk. The image contains
a Master Boot Record, and a partition table, so can be written to a raw device.
```console
$ sudo dd if=boot2docker.iso of=/dev/sdX
```
Making your own customised boot2docker ISO
==========================================
The `boot2docker.iso` release process takes advantage of Docker Hub's
[Automated Builds](https://index.docker.io/u/boot2docker/) so
rather than modifying the `Dockerfile` and re-building from scratch,
you can make a new ``Dockerfile`` that builds ``FROM boot2docker/boot2docker``
and then run that to generate your `boot2docker.iso` file:
```console
$ sudo docker pull boot2docker/boot2docker
$ echo "FROM boot2docker/boot2docker" > Dockerfile
$ echo "ADD . $ROOTFS/data/" >> Dockerfile
$ echo "RUN somescript.sh" >> Dockerfile
$ echo "RUN /make_iso.sh" >> Dockerfile
$ echo 'CMD ["cat", "boot2docker.iso"]' >> Dockerfile
$ sudo docker build -t my-boot2docker-img .
$ sudo docker run --rm my-boot2docker-img > boot2docker.iso
```

164
boot2docker/doc/FAQ.md Normal file
View File

@ -0,0 +1,164 @@
# FAQ
## I've just installed a new Boot2Docker and I get `client and server don't have the same version`
There's a good chance that your Boot2Docker virtual machine existed before you
upgraded your Docker client - what you need to run, is `boot2docker upgrade`.
For example, on Windows, having just installed using the 1.6.0 installer, I
had the following:
```
export DOCKER_TLS_VERIFY=1
You can now use `docker` directly, or `boot2docker ssh` to log into the VM.
Welcome to Git (version 1.9.4-preview20140929)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
svend_000@BIG ~
$ docker info
FATA[0000] Error response from daemon: client and server don't have same version
(client : 1.18, server: 1.17)
svend_000@BIG ~
$ boot2docker.exe upgrade
boot2docker is up to date (v1.6.0), skipping upgrade...
Latest release for github.com/boot2docker/boot2docker is v1.6.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download
/v1.6.0/boot2docker.iso
to C:\Users\svend_000\.boot2docker\boot2docker.iso
Waiting for VM and Docker daemon to start...
...............ooo
Started.
Writing C:\Users\svend_000\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\svend_000\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\svend_000\.boot2docker\certs\boot2docker-vm\key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_CERT_PATH='C:\Users\svend_000\.boot2docker\certs\boot2docker-v
m'
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
svend_000@BIG ~
$ docker info
Containers: 0
Images: 6
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 6
Dirperm1 Supported: true
Execution Driver: native-0.2
Kernel Version: 3.18.11-tinycore64
Operating System: Boot2Docker 1.6.0 (TCL 5.4); master : a270c71 - Thu Apr 16 19:
50:36 UTC 2015
CPUs: 8
Total Memory: 1.961 GiB
Name: boot2docker
ID: JGXX:ZFVX:WNJX:SSNB:QHU6:FP7P:VFDJ:EE3J:ZRYU:X3IR:6BD2:BEWM
Debug mode (server): true
Debug mode (client): false
Fds: 11
Goroutines: 16
System Time: Tue Apr 28 01:52:11 UTC 2015
EventsListeners: 0
Init SHA1: 9145575052383dbf64cede3bac278606472e027c
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
```
## What are the specs of the VM?
* CPU Cores: same as host (physical, not logical)
* 40gb HDD (auto-initialized at first boot)
* 2GB memory
* Autoboots to Boot2Docker
* `virtio` high performance networking
* NAT networked (Docker `2375->2375` and SSH `22->2022` are forwarded to the host)
## How can I solve my problems with SSH?
If `ssh` complains about the keys:
```
$ ssh-keygen -R '[localhost]:2022'
```
## Login as root
Run `sudo -s` as the docker user.
## What is the Boot2Docker distribution based on?
It is based on a stripped down [Tiny Core Linux](http://tinycorelinux.net).
## Why not CoreOS?
I got asked that question a lot, so I thought I should put it here once and for
all. [CoreOS](http://coreos.com/) is targeted at building infrastructure and
distributed systems. I just wanted the fastest way to boot to Docker.
## Persistent partition choice
Boot2Docker will first try to mount a partition labeled ``boot2docker-data``, if
that doesn't exist, it will pick the first ``ext4`` partition listed by ``blkid``.
## Local Customisation (with persistent partition)
Changes outside of the `/var/lib/docker` and `/var/lib/boot2docker` directories
will be lost after powering down or restarting the boot2docker VM. However, if
you have a persistence partition (created automatically by `boot2docker init`),
you can make customisations that are run at the end of boot initialisation by
creating a script at ``/var/lib/boot2docker/bootlocal.sh``.
From Boot2Docker version 1.6.0, you can also specify steps that are run before
the Docker daemon is started, using `/var/lib/boot2docker/bootsync.sh`.
You can also set variables that will be used during the boot initialisation (after
the automount) by setting them in `/var/lib/boot2docker/profile`
For example, to download ``pipework``, install its pre-requisites (which you can
download using ``tce-load -w package.tcz``), and then start a container:
```
#!/bin/sh
if [ ! -e /var/lib/boot2docker/pipework ]; then
curl -o /var/lib/boot2docker/pipework https://raw.github.com/jpetazzo/pipework/master/pipework
chmod 777 /var/lib/boot2docker/pipework
fi
#need ftp://ftp.nl.netbsd.org/vol/2/metalab/distributions/tinycorelinux/4.x/x86/tcz/bridge-utils.tcz
#and iproute2 (and its friends)
su - docker -c "tce-load -i /var/lib/boot2docker/*.tcz"
#start my management container if its not already there
docker run -d -v /var/run/docker.sock:/var/run/docker.sock $(which docker):$(which docker) -name dom0 svens-dom0
```
Or, if you need to tell the Docker daemon to use a specific DNS server, add the
following to ``/var/lib/boot2docker/profile``:
```
EXTRA_ARGS="--dns 192.168.1.2"
```
## What is the development process
We are implementing the same process as [Docker merge approval](
https://github.com/dotcloud/docker/blob/master/CONTRIBUTING.md#merge-approval),
so all commits need to be done via pull requests, and will need 2 or more LGTMs.
## Is boot2docker only for VirtualBox?
There are two parts of Boot2Docker: the ISO image, and the `boot2docker` management
tool to set up and manage a VM. The management tool only works with VirtualBox,
but the ISO image is designed to also be used with physical hardware. There
are no plans to make separate ISO images for different configurations.

View File

@ -0,0 +1,131 @@
Workarounds
===========
## Connection Issues
There are currently a few connections issues in Boot2docker. If you see
Couldn't connect to Docker daemon
or something like
FATA[0000] An error occurred trying to connect: Get https://192.168.59.107:2376/v1.18/containers/json?all=1: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.107
it could be one of many issues reported recently. Try this
boot2docker ssh sudo /etc/init.d/docker restart
and run `docker ps` to see if you can connect. If not, then try deleting the keys
boot2docker ssh sudo rm /var/lib/boot2docker/tls/server*.pem
boot2docker ssh sudo /etc/init.d/docker restart
boot2docker shellinit
and run `docker ps` to see if you can connect. If that doesn't work:
- `boot2docker restart`
- `docker ps` # Should see some output, not errors.
## Port forwarding
> **Note**: these instructions are for TCP only, not UDP. If you need to port forward
> UDP packets, the commands are similar. Please see the [VirtualBox
> NAT documentation](https://www.virtualbox.org/manual/ch06.html#network_nat)
> for more details.
Let's say your Docker container exposes the port 8000 and you want access it from
your other computers on your LAN. You can do it temporarily, using `ssh`:
Run following command (and keep it open) to use ssh to forward all accesses
to your OSX/Windows box's port 8000 to the Boot2Docker virtual machine's port
8000:
```sh
$ boot2docker ssh -vnNTL *:8000:localhost:8000
```
or you can set up a permanent VirtualBox NAT Port forwarding:
```sh
$ VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8000,tcp,,8000,,8000";
```
If the vm is already running, you should run this other command:
```sh
$ VBoxManage controlvm "boot2docker-vm" natpf1 "tcp-port8000,tcp,,8000,,8000";
```
Now you can access your container from your host machine under `localhost:8000`.
## Port forwarding on steroids
If you use a lot of containers which expose the same port, you have to use docker dynamic port forwarding.
For example, running 3 **nginx** containers:
- container-1 : 80 -> 49153 (i.e. `docker run -p 49153:80 ...`)
- container-2 : 80 -> 49154 (i.e. `docker run -p 49154:80 ...`)
- container-3 : 80 -> 49155 (i.e. `docker run -p 49155:80 ...`)
By using the `VBoxManage modifyvm` command of VirtualBox you can forward all 49XXX ports to your host. This way you can easily access all 3 webservers in you browser, without any ssh localforwarding hack. Here's how it looks like:
``` sh
# vm must be powered off
for i in {49000..49900}; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done
```
This makes `container-1` accessible at `localhost:49153`, and so on.
In order to reverse this change, you can do:
``` sh
# vm must be powered off
for i in {49000..49900}; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "tcp-port$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "udp-port$i";
done
```
## BTRFS (ie, mkfs inside a privileged container)
Note: AUFS on top of BTRFS has many, many issues, so the Docker engine's init script
will autodetect that `/var/lib/docker` is a `btrfs` partition and will set `-s btrfs`
for you.
```console
docker@boot2docker:~$ docker pull debian:latest
Pulling repository debian
...
docker@boot2docker:~$ docker run -i -t --rm --privileged -v /dev:/hostdev debian bash
root@5c3507fcae63:/# fdisk /hostdev/sda # if you need to partition your disk
Command: o
Command: n
Select: p
Partition: <enter>
First sector: <enter>
Last sector: <enter>
Command: w
root@5c3507fcae63:/# apt-get update && apt-get install btrfs-tools
...
The following NEW package will be installed:
btrfs-tools
...
Setting up btrfs-tools (...) ...
root@5c3507fcae63:/# mkfs.btrfs -L boot2docker-data /hostdev/sda1
...
fs created label boot2docker-data on /hostdev/sda1
...
root@5c3507fcae63:/# exit
docker@boot2docker:~$ sudo reboot
```

4592
boot2docker/kernel_config Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
# restart ntpd to combat laptop sleep + VM pause
0 * * * * killall ntpd > /dev/null 2>&1; /etc/rc.d/ntpd

Binary file not shown.

View File

@ -0,0 +1,16 @@
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Press <Enter> to begin or F2, F3, or F4 to view boot options.

View File

@ -0,0 +1,16 @@
At boot prompt enter mc followed by one or more space seperated options:
tce={hda1|sda1} Specify Restore TCE apps directory
restore={hda1|sda1|floppy} Specify saved configuration location
waitusb=X Wait X seconds for slow USB devices
swapfile{=hda1} Scan or Specify swapfile
home={hda1|sda1} Specify persistent home directory
opt={hda1|sda1} Specify persistent opt directory
lst=yyy.lst Load alternate static yyy.lst on boot
base Do not load any extensions.
norestore Turn off the automatic restore
safebackup Saves a backup copy (mydatabk.tgz)
showapps Display application names when booting
iso=sdb1 Boot directly from iso file at sdb1
iso==/mnt/sdb1/multiboot/ISOS/TinyCore-4.4.iso

View File

@ -0,0 +1,21 @@
At boot prompt enter mc followed by one or more space seperated options:
Color 640x480 800x600 1024x768 1280x1024
256 8 bit 769 771 773 775
32000 15 bit 784 787 790 793
65000 16 bit 785 788 791 794
16.7M 24 bit 786 789 792 795
vga=7xx 7xx from table above
xsetup Prompt user for Xvesa setup
lang=en C only unless getlocale.tcz is installed
kmap=us US only unless kmaps.tcz is installed
text Textmode
superuser Textmode as user root
noicons Do not display icons
noicons=ondemand Do not display ondemand icons
noswap Do not use swap partition
nodhcp Skip the dhcp request at boot
noutc BIOS is using localtime
pause Pause at completion of boot messages

View File

@ -0,0 +1,18 @@
At boot prompt enter mc followed by one or more space seperated options:
{cron|syslog} Start various daemons at boot
host=xxxx Set hostname to xxxx
secure Set password
protect Password Encrypted Backup
noautologin Skip automatic login
tz=GMT+8 Timezone tz=PST+8PDT,M3.2.0/2,M11.1.0/2
user=abc Specify alternate user
desktop=yyy Specify alternate window manager
laptop Force load laptop related modules
noembed Unpack initramfs to tmpfs
nozswap Skip compressed swap in ram
xvesa=800x600x32 Set Xvesa default screen resolution
mydata=yyy Specify alternate backup file name.
blacklist=ssb Blacklist a single module
multivt Allows for multiple virtual terminals

Binary file not shown.

View File

@ -0,0 +1,24 @@
serial 0 9600
display boot.msg
default boot2docker
label boot2docker
kernel /boot/vmlinuz64 com1=9600,8n1
initrd /boot/initrd.img
append loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10:LABEL=boot2docker-data base
# see http://www.syslinux.org/wiki/index.php/SYSLINUX
# If flag_val is 0, do not load a kernel image unless it has been explicitly named in a LABEL statement. The default is 1.
implicit 0
# If flag_val is 0, display the boot: prompt only if the Shift or Alt key is pressed, or Caps Lock or Scroll lock is set (this is the default). If flag_val is 1, always display the boot: prompt.
prompt 1
# Indicates how long to pause at the boot: prompt until booting automatically, in units of 1/10 s. The timeout is cancelled when any key is pressed, the assumption being the user will complete the command line. A timeout of zero will disable the timeout completely. The default is 0.
timeout 1
# Displays the indicated file on the screen when a function key is pressed at the boot: prompt. This can be used to implement pre-boot online help (presumably for the kernel command line options).
F1 boot.msg
F2 f2
F3 f3
F4 f4

51
boot2docker/rootfs/make_iso.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
set -e
# Ensure init system invokes /opt/shutdown.sh on reboot or shutdown.
# 1) Find three lines with `useBusyBox`, blank, and `clear`
# 2) insert run op after those three lines
sed -i "1,/^useBusybox/ { /^useBusybox/ { N;N; /^useBusybox\n\nclear/ a\
\\\n\
# Run boot2docker shutdown script\n\
test -x \"/opt/shutdown.sh\" && /opt/shutdown.sh\n
} }" $ROOTFS/etc/init.d/rc.shutdown
# Verify sed worked
grep -q "/opt/shutdown.sh" $ROOTFS/etc/init.d/rc.shutdown || ( echo "Error: failed to insert shutdown script into /etc/init.d/rc.shutdown"; exit 1 )
# Make some handy symlinks (so these things are easier to find)
ln -fs /var/lib/boot2docker/docker.log $ROOTFS/var/log/
ln -fs /usr/local/etc/init.d/docker $ROOTFS/etc/init.d/
# Setup /etc/os-release with some nice contents
b2dVersion="$(cat $ROOTFS/etc/version)" # something like "1.1.0"
b2dDetail="$(cat $ROOTFS/etc/boot2docker)" # something like "master : 740106c - Tue Jul 29 03:29:25 UTC 2014"
tclVersion="$(cat $ROOTFS/usr/share/doc/tc/release.txt)" # something like "5.3"
cat > $ROOTFS/etc/os-release <<-EOOS
NAME=Boot2Docker
VERSION=$b2dVersion
ID=boot2docker
ID_LIKE=tcl
VERSION_ID=$b2dVersion
PRETTY_NAME="Boot2Docker $b2dVersion (TCL $tclVersion); $b2dDetail"
ANSI_COLOR="1;34"
HOME_URL="http://boot2docker.io"
SUPPORT_URL="https://github.com/boot2docker/boot2docker"
BUG_REPORT_URL="https://github.com/boot2docker/boot2docker/issues"
EOOS
# Pack the rootfs
cd $ROOTFS
find | ( set -x; cpio -o -H newc ) > /tmp/iso/boot/initrd.img
cd -
# Make the ISO
# Note: only "-isohybrid-mbr /..." is specific to xorriso.
# It builds an image that can be used as an ISO *and* a disk image.
#xorriso \
# -publisher "Docker Inc." \
# -as mkisofs \
# -l -J -R -V "Boot2Docker-v$(cat $ROOTFS/etc/version)" \
# -no-emul-boot -boot-load-size 4 -boot-info-table \
# -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
# -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
# -o /boot2docker.iso /tmp/iso

View File

@ -0,0 +1,117 @@
#!/bin/sh
# Configure sysctl
/etc/rc.d/sysctl
# Load TCE extensions
/etc/rc.d/tce-loader
# Automount a hard drive
/etc/rc.d/automount
# Mount cgroups hierarchy
/etc/rc.d/cgroupfs-mount
# see https://github.com/tianon/cgroupfs-mount
mkdir -p /var/lib/boot2docker/log
# Add any custom certificate chains for secure private registries
/etc/rc.d/install-ca-certs
# import settings from profile (or unset them)
test -f "/var/lib/boot2docker/profile" && . "/var/lib/boot2docker/profile"
# set the hostname
/etc/rc.d/hostname
# sync the clock
/etc/rc.d/ntpd &
# start cron
/etc/rc.d/crond
# TODO: move this (and the docker user creation&pwd out to its own over-rideable?))
if grep -q '^docker:' /etc/passwd; then
# if we have the docker user, let's create the docker group
/bin/addgroup -S docker
# ... and add our docker user to it!
/bin/addgroup docker docker
#preload data from boot2docker-cli
if [ -e "/var/lib/boot2docker/userdata.tar" ]; then
tar xf /var/lib/boot2docker/userdata.tar -C /home/docker/ > /var/log/userdata.log 2>&1
rm -f '/home/docker/boot2docker, please format-me'
chown -R docker:staff /home/docker
fi
fi
# Launch Docker
/etc/rc.d/docker
# Listen for requests
mkdir -p /Socket
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 socket /Socket
/sbin/9pudc -path /Socket -sock /var/run/docker.sock -detach &
mkdir -p /Mac
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 plan9 /Mac
mkdir -p /Irmin
#mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 irmin /Irmin
# Automount Shared Folders (VirtualBox, etc.); start VBox services
# /etc/rc.d/vbox
# Trigger the DHCP request sooner (the x64 bit userspace appears to be a second slower)
echo "$(date) dhcp -------------------------------"
/etc/rc.d/dhcp.sh
echo "$(date) dhcp -------------------------------"
# Configure SSHD
/etc/rc.d/sshd
# Launch ACPId
/etc/rc.d/acpid
echo "-------------------"
date
#maybe the links will be up by now - trouble is, on some setups, they may never happen, so we can't just wait until they are
#sleep 5
date
ip a
echo "-------------------"
# Allow local bootsync.sh customisation
#if [ -e /var/lib/boot2docker/bootsync.sh ]; then
# /bin/sh /var/lib/boot2docker/bootsync.sh
# echo "------------------- ran /var/lib/boot2docker/bootsync.sh"
#fi
# Allow local HD customisation
#if [ -e /var/lib/boot2docker/bootlocal.sh ]; then
# /bin/sh /var/lib/boot2docker/bootlocal.sh > /var/log/bootlocal.log 2>&1 &
# echo "------------------- ran /var/lib/boot2docker/bootlocal.sh"
#fi
# Execute automated_script
# disabled - this script was written assuming bash, which we no longer have.
#/etc/rc.d/automated_script.sh
# Run Hyper-V KVP Daemon
#if modprobe hv_utils &> /dev/null; then
# /usr/sbin/hv_kvp_daemon
#fi
# Launch vmware-tools
#/etc/rc.d/vmtoolsd
# Launch xenserver-tools
#/etc/rc.d/xedaemon
# Load Parallels Tools daemon
#/etc/rc.d/prltoolsd
# FIXME this hides kernel warning messages from 9p which should be fixed really
sysctl -w kernel.printk="3 4 1 3"
hostname docker
echo Bootscript finished

View File

@ -0,0 +1,10 @@
#!/bin/sh
. /etc/init.d/tc-functions
echo "${YELLOW}Running boot2docker init script...${NORMAL}"
# This log is started before the persistence partition is mounted
/opt/bootscript.sh 2>&1 | tee -a /var/log/boot2docker.log &
echo "${YELLOW}Finished boot2docker init script...${NORMAL}"

View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Boot2Docker version $(cat /etc/version), build $(cat /etc/boot2docker)"
docker -v # "Docker version 1.3.0-dev, build ba14ddf-dirty"

View File

@ -0,0 +1,2 @@
# Launch ACPId (shutdown)
/usr/local/etc/init.d/acpid start

View File

@ -0,0 +1,34 @@
#!/bin/bash
script_cmdline ()
{
local param
for param in $(< /proc/cmdline); do
case "${param}" in
script=*) echo "${param##*=}" ; return 0 ;;
esac
done
}
automated_script ()
{
local script rt
script="$(script_cmdline)"
if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then
if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then
curl -fsL "${script}" -o /tmp/startup_script
rt=$?
else
cp "${script}" /tmp/startup_script
rt=$?
fi
if [[ ${rt} -eq 0 ]]; then
chmod +x /tmp/startup_script
/tmp/startup_script
fi
fi
}
if [[ $(tty) == "/dev/tty1" ]]; then
automated_script
fi

View File

@ -0,0 +1,129 @@
#!/bin/sh
echo "automount ...";
LABEL=boot2docker-data
MAGIC="boot2docker, please format-me"
# If there is a partition with `boot2docker-data` as its label, use it and be
# very happy. Thus, you can come along if you feel like a room without a roof.
BOOT2DOCKER_DATA=`blkid -o device -l -t LABEL=$LABEL`
echo $BOOT2DOCKER_DATA
if [ ! -n "$BOOT2DOCKER_DATA" ]; then
echo "Is the disk unpartitioned?, test for the 'boot2docker format-me' string"
# Is the disk unpartitioned?, test for the 'boot2docker format-me' string
UNPARTITIONED_HD=`fdisk -l | grep "doesn't contain a valid partition table" | head -n 1 | sed 's/Disk \(.*\) doesn.*/\1/'`
if [ -n "$UNPARTITIONED_HD" ]; then
# Test for our magic string (it means that the disk was made by ./boot2docker init)
HEADER=`dd if=$UNPARTITIONED_HD bs=1 count=${#MAGIC} 2>/dev/null`
if [ "$HEADER" = "$MAGIC" ]; then
# save the preload userdata.tar file
dd if=$UNPARTITIONED_HD of=/userdata.tar bs=1 count=4096 2>/dev/null
# Create the partition, format it and then mount it
echo "NEW boot2docker managed disk image ($UNPARTITIONED_HD): formatting it for use"
echo "NEW boot2docker managed disk image ($UNPARTITIONED_HD): formatting it for use" > /home/docker/log.log
# Add a swap partition (so Docker doesn't complain about it missing)
(echo n; echo p; echo 2; echo ; echo +1000M ; echo w) | fdisk $UNPARTITIONED_HD
# Let kernel re-read partition table
partprobe
(echo t; echo 82; echo w) | fdisk $UNPARTITIONED_HD
# Let kernel re-read partition table
partprobe
mkswap "${UNPARTITIONED_HD}2"
# Add the data partition
(echo n; echo p; echo 1; echo ; echo ; echo w) | fdisk $UNPARTITIONED_HD
# Let kernel re-read partition table
partprobe
BOOT2DOCKER_DATA=`echo "${UNPARTITIONED_HD}1"`
mkfs.ext4 -L $LABEL $BOOT2DOCKER_DATA
swapon "${UNPARTITIONED_HD}2"
fi
DISK_VENDOR=$(cat /sys/class/block/$(basename $UNPARTITIONED_HD /dev/)/device/vendor /sys/class/block/$(basename $UNPARTITIONED_HD /dev/)/device/model | tr -d "\n")
# Test if disk is "VMware, VMware Virtual S" and empty.
if [ "$DISK_VENDOR" = "VMware, VMware Virtual S" ] || [ "$DISK_VENDOR" = "VMware Virtual disk " ]; then
# Check whether the disk has any known partitions on it
blkid -o device $UNPARTITIONED_HD
if [ $? == 2 ]; then
# As there are no partitions, let's make sure the disk is empty for real
dd if=$UNPARTITIONED_HD of=device_test_file bs=1k count=256 > /dev/null 2>&1
NON_NUL=$(<device_test_file tr -d '\0\n' | wc -c)
if [ $NON_NUL == 0 ]; then
# Create the partition, format it and then mount it
echo "NEW VMware boot2docker managed disk image ($UNPARTITIONED_HD): formatting it for use"
echo "NEW VMware boot2docker managed disk image ($UNPARTITIONED_HD): formatting it for use" > /home/docker/log.log
# Add a swap partition (so Docker doesn't complain about it missing)
(echo n; echo p; echo 2; echo ; echo +1000M ; echo w) | fdisk $UNPARTITIONED_HD
(echo t; echo 82) | fdisk $UNPARTITIONED_HD
mkswap "${UNPARTITIONED_HD}2"
# Add the data partition
(echo n; echo p; echo 1; echo ; echo ; echo w) | fdisk $UNPARTITIONED_HD
BOOT2DOCKER_DATA=`echo "${UNPARTITIONED_HD}1"`
mkfs.ext4 -L $LABEL $BOOT2DOCKER_DATA
swapon "${UNPARTITIONED_HD}2"
else
echo "Disk unpartitioned but something is there... not doing anything"
fi
else
echo "Partition table found on disk, not doing anything"
fi
fi
else
# Pick the first ext4 as a fallback
# TODO: mount all Linux partitions and look for a /var/lib/docker...
BOOT2DOCKER_DATA=`blkid | grep -e 'TYPE="btrfs"' -e 'TYPE="ext4"' | head -n 1 | sed 's/:.*//'`
fi
fi
echo $BOOT2DOCKER_DATA
if [ -n "$BOOT2DOCKER_DATA" ]; then
PARTNAME=`echo "$BOOT2DOCKER_DATA" | sed 's/.*\///'`
echo "mount p:$PARTNAME ..."
mkdir -p /mnt/$PARTNAME
if ! mount $BOOT2DOCKER_DATA /mnt/$PARTNAME 2>/dev/null; then
# for some reason, mount doesn't like to modprobe btrfs
BOOT2DOCKER_FSTYPE=`blkid -o export $BOOT2DOCKER_DATA | grep TYPE= | cut -d= -f2`
modprobe $BOOT2DOCKER_FSTYPE || true
umount -f /mnt/$PARTNAME || true
mount $BOOT2DOCKER_DATA /mnt/$PARTNAME
fi
# Just in case, the links will fail if not
umount -f /var/lib/docker || true
rm -rf /var/lib/docker /var/lib/boot2docker
if [ -d /mnt/$PARTNAME/vm ]; then
# The old behavior - use the entire disk for boot2docker data
ln -s /mnt/$PARTNAME /var/lib/docker
# Give us a link to the new cusomisation location
ln -s /var/lib/docker/vm /var/lib/boot2docker
else
# Detected a disk with a normal linux install (/var/lib/docker + more))
mkdir -p /var/lib
mkdir -p /mnt/$PARTNAME/var/lib/docker
ln -s /mnt/$PARTNAME/var/lib/docker /var/lib/docker
mkdir -p /mnt/$PARTNAME/var/lib/boot2docker
ln -s /mnt/$PARTNAME/var/lib/boot2docker /var/lib/boot2docker
fi
# Make sure /tmp is on the disk too too
rm -rf /mnt/$PARTNAME/tmp || true
mv /tmp /mnt/$PARTNAME/tmp
ln -fs /mnt/$PARTNAME/tmp /tmp
if [ -e "/userdata.tar" ]; then
mv /userdata.tar /var/lib/boot2docker/
fi
ls -l /mnt/$PARTNAME
fi
# /etc dirs are initialised from /usr/local, to allow the user/admin to customise
mkdir -p /var/lib/boot2docker/etc/
echo "automount over."

View File

@ -0,0 +1,61 @@
#!/bin/sh
# Copyright 2011 Canonical, Inc
# 2014 Tianon Gravi
# Author: Serge Hallyn <serge.hallyn@canonical.com>
# Tianon Gravi <admwiggin@gmail.com>
set -e
# doh, TCL doesn't have "mountpoint"
mountpoint() {
dashQ=$1
dir=$(readlink -f "$2")
grep -q " $dir " /proc/mounts
}
# for simplicity this script provides no flexibility
# if cgroup is mounted by fstab, don't run
# don't get too smart - bail on any uncommented entry with 'cgroup' in it
if grep -v '^#' /etc/fstab | grep -q cgroup; then
echo 'cgroups mounted from fstab, not mounting /sys/fs/cgroup'
exit 0
fi
# kernel provides cgroups?
if [ ! -e /proc/cgroups ]; then
exit 0
fi
# if we don't even have the directory we need, something else must be wrong
if [ ! -d /sys/fs/cgroup ]; then
exit 0
fi
# mount /sys/fs/cgroup if not already done
if ! mountpoint -q /sys/fs/cgroup; then
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi
cd /sys/fs/cgroup
# get/mount list of enabled cgroup controllers
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rmdir $sys || true
fi
fi
done
# example /proc/cgroups:
# #subsys_name hierarchy num_cgroups enabled
# cpuset 2 3 1
# cpu 3 3 1
# cpuacct 4 3 1
# memory 5 3 0
# devices 6 3 1
# freezer 7 3 1
# blkio 8 3 1
exit 0

View File

@ -0,0 +1,4 @@
#!/bin/sh
: ${CROND_LOGLEVEL:=8}
crond -f -d "$CROND_LOGLEVEL" > /var/lib/boot2docker/log/crond.log 2>&1 &

View File

@ -0,0 +1,3 @@
#!/bin/sh
/usr/local/etc/init.d/docker start

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ ! -e /var/lib/boot2docker/etc/hostname ]; then
cp /usr/local/etc/hostname /var/lib/boot2docker/etc/hostname
fi
HOSTNAME=`cat /var/lib/boot2docker/etc/hostname`
/usr/bin/sethostname $HOSTNAME

View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert_file in "${BOOT2DOCKER_CERTS_DIR}"/*.pem; do
cert=`basename $cert_file`
echo "installing $cert"
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(openssl x509 -noout -hash -in "${SRC_CERT_FILE}" 2>/dev/null)
[ ! -L "${CERT_FILE}" ] && ln -fs "${SRC_CERT_FILE}" "${CERT_FILE}"
for idx in $(seq 0 9); do
if [ -L "${HASH_FILE}.${idx}" ]; then
if [ "$(readlink "${HASH_FILE}.${idx}")" = "${SRC_CERT_FILE}" ]; then
break
fi
else
ln -fs "${SRC_CERT_FILE}" "${HASH_FILE}.${idx}"
break
fi
done
cat "${SRC_CERT_FILE}" >> "${CAFILE}"
done

View File

@ -0,0 +1,18 @@
#!/bin/sh
: ${NTP_SERVER:=pool.ntp.org}
if [ -n "$NTP_SERVER" ]; then
# Wait on the network
count=10
while ! ping -c 1 $NTP_SERVER > /dev/null 2>&1; do
sleep 1
count=$(( count - 1 ))
if [ $count -lt 1 ]; then
break
fi
done
ntpd -d -n -p $NTP_SERVER > /var/lib/boot2docker/log/ntpd.log 2>&1 &
else
echo 'NTP_SERVER not set; skipping starting ntpd' > /var/lib/boot2docker/log/ntpd.log
fi

View File

@ -0,0 +1,3 @@
#!/bin/sh
/usr/local/etc/init.d/prltoolsd start

View File

@ -0,0 +1,24 @@
#!/bin/sh
# Configure sshd and acknowledge for persistence in /var/lib/boot2docker of the keys/config
# Move /usr/local/etc/ssh to /var/lib/boot2docker/ssh if it doesn't exist
if [ ! -d /var/lib/boot2docker/ssh ]; then
mv /usr/local/etc/ssh /var/lib/boot2docker/
else # if it exists, remove the ramdisk's ssh config, so that the hard drive's is properly linked
rm -rf /usr/local/etc/ssh
fi
ln -s /var/lib/boot2docker/ssh /usr/local/etc/ssh
if [ ! -f /usr/local/etc/ssh/ssh_config ]; then
mv /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
fi
if [ ! -f /usr/local/etc/ssh/sshd_config ]; then
mv /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
fi
if ! grep -q "^UseDNS no" /usr/local/etc/ssh/sshd_config; then
# speed up login
echo "UseDNS no" >> /usr/local/etc/ssh/sshd_config
fi
/usr/local/etc/init.d/openssh start

View File

@ -0,0 +1,2 @@
# Read sysctl.conf
sysctl -p /etc/sysctl.conf

View File

@ -0,0 +1,2 @@
#!/bin/sh
find /usr/local/tce.installed/ -type f -exec sh -c {} \;

View File

@ -0,0 +1,47 @@
#!/bin/sh
set -e
# VirtualBox Guest Additions
# - this will bail quickly and gracefully if we're not in VBox
if modprobe vboxguest &> /dev/null && modprobe vboxsf &> /dev/null; then
# fire up VBoxService to do timesync, etc
VBoxService --disable-automount
# TODO some testing with VBoxService automount so we can trim down this entire hacky script
mountOptions='defaults,iocharset=utf8'
if grep -q '^docker:' /etc/passwd; then
mountOptions="${mountOptions},uid=$(id -u docker),gid=$(id -g docker)"
fi
# try mounting "$name" (which defaults to "$dir") at "$dir",
# but quietly clean up empty directories if it fails
try_mount_share() {
dir="$1"
name="${2:-$dir}"
mkdir -p "$dir" 2>/dev/null
if ! mount -t vboxsf -o "$mountOptions" "$name" "$dir" 2>/dev/null; then
rmdir "$dir" 2>/dev/null || true
while [ "$(dirname "$dir")" != "$dir" ]; do
dir="$(dirname "$dir")"
rmdir "$dir" 2>/dev/null || break
done
return 1
fi
return 0
}
# bfirsh gets all the credit for this hacky workaround :)
try_mount_share /Users 'Users' \
|| try_mount_share /Users \
|| try_mount_share /c/Users 'c/Users' \
|| try_mount_share /c/Users \
|| try_mount_share /c/Users 'c:/Users' \
|| true
# TODO replace this whole hacky bit with VBoxService --only-automount
# (the problem with that being that we can't run VBoxService because the
# 32bit VBoxService won't work with the 64bit kernel modules, but the 64bit
# VBoxService won't work with our 32bit userspace; good times)
fi

View File

@ -0,0 +1,17 @@
#!/bin/sh
SYSTYPE=$(cat /sys/class/dmi/id/sys_vendor | grep -ic vmware)
if [ "$SYSTYPE" -gt 0 ]; then
# Creates mountpoint for Shared Folders
if [ ! -d /mnt/hgfs ]; then
mkdir -p /mnt/hgfs
# try to mount the root shared folder, this command can fail
# if shared folders are disabled on the host, vmtoolsd will take care of the mount
# if they are enabled while the machine is running.
/usr/local/bin/vmhgfs-fuse -o allow_other .host:/ /mnt/hgfs
fi
ln -s /usr/local/bin/lsb_release /usr/bin/lsb_release
/usr/local/bin/vmtoolsd --background /var/run/vmtoolsd.pid
fi

View File

@ -0,0 +1,8 @@
#!/bin/sh
# Tips: xentools will not start up if we're not on a Xen platform.
# 1. /etc/init.d/xe-linux-distribution will start /usr/sbin/xe-daemon.
# 2. Then /usr/sbin/xe-daemon will quit if the VM is not run on a Xen platform.
if [ -x /etc/init.d/xe-linux-distribution ]; then
/etc/init.d/xe-linux-distribution start
fi

View File

@ -0,0 +1,2 @@
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

Binary file not shown.

View File

@ -0,0 +1,32 @@
#!/bin/sh
usage()
{
echo 'Usage: shutdown [-rh] time
-r: reboot after shutdown.
-h: halt after shutdown.
** the "time" argument is mandatory! (try "now") **' >&2
exit 1
}
case $1 in
-r) CMD="/bin/busybox reboot"
;;
-h) CMD="/bin/busybox poweroff"
;;
*) usage
;;
esac
shift
case $1 in
now|+0) DELAY=""
;;
+[0-9]*) DELAY=$(($1 * 60))
;;
*) usage
;;
esac
${CMD}${DELAY:+ -d $DELAY}

View File

@ -0,0 +1,6 @@
#!/bin/sh
. /etc/init.d/tc-functions
echo "${YELLOW}Running boot2docker shutdown script...${NORMAL}"
/usr/local/etc/init.d/docker stop

View File

@ -0,0 +1,8 @@
#!/bin/sh
# just to make open-vm-tools happy, nad fake output
# of lsb_release -sd
. /etc/os-release
echo $PRETTY_NAME
exit 0

View File

@ -0,0 +1,2 @@
event=button/power*
action=/sbin/poweroff

View File

@ -0,0 +1 @@
docker

View File

@ -0,0 +1,141 @@
#!/bin/sh
# docker daemon start script
[ $(id -u) = 0 ] || { echo 'must be root' ; exit 1; }
# https://github.com/docker/docker/issues/11382
export DOCKER_RAMDISK=true
#import settings from profile (e.g. HTTP_PROXY, HTTPS_PROXY)
test -f '/var/lib/boot2docker/profile' && . '/var/lib/boot2docker/profile'
: ${DOCKER_HOST:='-H tcp://0.0.0.0:2375'}
: ${DOCKER_TLS:=no}
: ${DOCKER_STORAGE:=auto}
: ${DOCKER_DIR:=/var/lib/docker}
: ${DOCKER_ULIMITS:=1048576}
: ${DOCKER_LOGFILE:=/var/lib/boot2docker/docker.log}
: ${CERTDIR:=/var/lib/boot2docker/tls/}
: ${CERT_INTERFACES:='eth0 eth1'}
: ${CACERT:="${CERTDIR}ca.pem"}
: ${CAKEY:="${CERTDIR}cakey.pem"}
: ${SERVERCERT:="${CERTDIR}server.pem"}
: ${SERVERKEY:="${CERTDIR}serverkey.pem"}
: ${CERT:="${CERTDIR}cert.pem"}
: ${KEY:="${CERTDIR}key.pem"}
: ${ORG:=Boot2Docker}
: ${SERVERORG:="${ORG}"}
: ${CAORG:="${ORG}CA"} # Append 'CA'; see <http://rt.openssl.org/Ticket/History.html?use r=guest&pass=guest&id=3979>
# Add /usr/local/sbin to the path.
export PATH=${PATH}:/usr/local/sbin
start() {
# Not enabling Docker daemon TLS by default.
if [ "$DOCKER_TLS" != "no" ]; then
CERTHOSTNAMES="$(hostname -s),$(hostname -i)"
for interface in ${CERT_INTERFACES}; do
IPS=$(ip addr show ${interface} |sed -nEe 's/^[ \t]*inet[ \t]*([0-9.]+)\/.*$/\1/p')
for ip in $IPS; do
CERTHOSTNAMES="$CERTHOSTNAMES,$ip"
done
done
echo "Need TLS certs for $CERTHOSTNAMES"
echo "-------------------"
mkdir -p "$CERTDIR"
chmod 700 "$CERTDIR"
if [ ! -f "$CACERT" ] || [ ! -f "$CAKEY" ]; then
echo "Generating CA cert"
/usr/local/bin/generate_cert --cert="$CACERT" --key="$CAKEY" --org="$CAORG"
rm "$SERVERCERT" "$SERVERKEY" "$CERT" "$KEY" "$CERTDIR/hostnames"
fi
CERTSEXISTFOR=$(cat "$CERTDIR/hostnames" 2>/dev/null)
if [ "$CERTHOSTNAMES" != "$CERTSEXISTFOR" ]; then
echo "Generate server cert"
echo /usr/local/bin/generate_cert --host="$CERTHOSTNAMES" --ca="$CACERT" --ca-key="$CAKEY" --cert="$SERVERCERT" --key="$SERVERKEY" --org="$SERVERORG"
/usr/local/bin/generate_cert --host="$CERTHOSTNAMES" --ca="$CACERT" --ca-key="$CAKEY" --cert="$SERVERCERT" --key="$SERVERKEY" --org="$SERVERORG"
echo "$CERTHOSTNAMES" > "$CERTDIR/hostnames"
fi
if [ ! -f "$CERT" ] || [ ! -f "$KEY" ]; then
echo "Generating client cert"
/usr/local/bin/generate_cert --ca="$CACERT" --ca-key="$CAKEY" --cert="$CERT" --key="$KEY" --org="$ORG"
fi
if [ "$DOCKER_TLS" == "auto" ]; then
DOCKER_HOST='-H tcp://0.0.0.0:2376'
EXTRA_ARGS="$EXTRA_ARGS --tlsverify --tlscacert=$CACERT --tlscert=$SERVERCERT --tlskey=$SERVERKEY"
elif [ "$DOCKER_TLS" != "no" ]; then
EXTRA_ARGS="$EXTRA_ARGS $DOCKER_TLS --tlscacert=$CACERT --tlscert=$SERVERCERT --tlskey=$SERVERKEY"
fi
# now make the client certificates available to the docker user
USERCFG="/home/docker/.docker"
mkdir -p "$USERCFG"
chmod 700 "$USERCFG"
cp "$CACERT" "$USERCFG"
cp "$CERT" "$USERCFG"
cp "$KEY" "$USERCFG"
chown -R docker:staff "$USERCFG"
fi
mkdir -p "$DOCKER_DIR"
if [ "$DOCKER_STORAGE" = 'auto' ]; then
# if /var/lib/docker is on BTRFS, let's use the native btrfs driver
# (AUFS on top of BTRFS does very bad things)
DOCKER_DEVICE="$(/bin/df -P "$DOCKER_DIR" | /usr/bin/awk 'END { print $1 }')"
DOCKER_FSTYPE="$(/sbin/blkid -o export "$DOCKER_DEVICE" | /bin/grep TYPE= | /usr/bin/cut -d= -f2)"
if [ "$DOCKER_FSTYPE" = 'btrfs' ]; then
DOCKER_STORAGE="$DOCKER_FSTYPE"
fi
fi
if [ "$DOCKER_STORAGE" != 'auto' ]; then
# in the general case, let's trust Docker to "do the right thing"
EXTRA_ARGS="$EXTRA_ARGS -s $DOCKER_STORAGE"
fi
# Increasing the number of open files and processes by docker
ulimit -n $DOCKER_ULIMITS
ulimit -p $DOCKER_ULIMITS
echo "------------------------" >> "$DOCKER_LOGFILE"
echo "/usr/local/bin/docker daemon -D -g \"$DOCKER_DIR\" -H unix:// $DOCKER_HOST $EXTRA_ARGS >> \"$DOCKER_LOGFILE\"" >> "$DOCKER_LOGFILE"
/usr/local/bin/docker daemon -D -g "$DOCKER_DIR" -H unix:// $DOCKER_HOST $EXTRA_ARGS >> "$DOCKER_LOGFILE" 2>&1 &
}
stop() {
kill $(cat /var/run/docker.pid)
}
restart() {
if check; then
stop && sleep 1 && start
else
start
fi
}
check() {
[ -f /var/run/docker.pid ] && ps -A -o pid | grep "^\s*$(cat /var/run/docker.pid)$" > /dev/null 2>&1
}
status() {
if check; then
echo 'Docker daemon is running'
exit 0
else
echo 'Docker daemon is not running'
exit 1
fi
}
case $1 in
start) start;;
stop) stop;;
restart) restart;;
status) status;;
*) echo "Usage $0 {start|stop|restart|status}"; exit 1
esac

View File

@ -0,0 +1,13 @@
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|

View File

@ -0,0 +1,53 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
echo "$(date) ifconfig $interface $ip $BROADCAST $NETMASK" >> /var/log/udhcp.log
if [ -n "$router" ] ; then
echo "$(date) deleting routers" >> /var/log/udhcp.log
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
metric=0
for i in $router ; do
echo "$(date) route add default gw $i dev $interface metric $((metric++))" >> /var/log/udhcp.log
route add default gw $i dev $interface metric $((metric++))
done
# avoid resetting the resolv.conf for any additional netdevs,
# as the first is the one the Docker daemon will use to pull images
if [ -n "$dns" ] ; then
echo "$(date) reset $RESOLV_CONF" >> /var/log/udhcp.log
echo -n > $RESOLV_CONF
fi
if [ -n "$domain" ] ; then
echo "$(date) search $domain" >> /var/log/udhcp.log
echo search $domain >> $RESOLV_CONF
fi
fi
for i in $dns ; do
echo "$(date) adding dns $i" >> /var/log/udhcp.log
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0