Created
July 25, 2014 19:32
-
-
Save joaodubas/66f8749b0d1d3cce5e64 to your computer and use it in GitHub Desktop.
docker image to install nsinit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nsinit installer | |
# | |
# VERSION: see `TAG` | |
FROM ubuntu:14.04 | |
MAINTAINER Joao Paulo Dubas "[email protected]" | |
# install deps | |
RUN apt-get -y -qq --force-yes update \ | |
&& apt-get -y -qq --force-yes install build-essential wget git | |
# download golang | |
ENV GOVERSION 1.3 | |
ENV GOFILE go${GOVERSION}.linux-amd64.tar.gz | |
ENV GOURL http://golang.org/dl/$GOFILE | |
RUN mkdir -p /opt/src \ | |
&& cd /opt/src \ | |
&& wget ${GOURL} \ | |
&& tar -xzf ${GOFILE} | |
# install golang | |
RUN mkdir -p /opt/bin \ | |
&& ln -s /opt/src/go/bin/* /opt/bin/ | |
ENV PATH /opt/bin:$PATH | |
# configure golang | |
RUN mkdir -p /opt/go | |
ENV GOROOT /opt/src/go | |
ENV GOPATH /opt/go | |
ENV PATH $GOPATH/bin:$PATH | |
# install nsinit | |
RUN go get -d github.com/docker/libcontainer/nsinit/nsinit \ | |
&& go install github.com/docker/libcontainer/nsinit/nsinit \ | |
&& cp ${GOPATH}/bin/nsinit / | |
# add installer | |
ADD installer /installer | |
# configure container | |
CMD ["/installer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copied from https://github.com/jpetazzo/nsenter | |
if mountpoint -q /target; then | |
echo "Installing nsinit to /target" | |
cp /nsinit /target | |
else | |
echo "/target is not a mountpoint" | |
echo "You can either:" | |
echo " - re-run this container with -v /usr/local/bin:/target" | |
echo " - extract nsinit binary (located at /nsinit)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment