1
+ FROM ubuntu:12.04
2
+
3
+ # much of this was gleaned from https://github.com/lxc/lxc/blob/lxc-0.8.0/templates/lxc-ubuntu.in
4
+ # and then heavily modified and hacked like crazy
5
+
6
+ # we're going to want this bad boy installed so we can connect :)
7
+ RUN apt-get update && apt-get install -y ssh python
8
+
9
+ ADD init-fake.conf /etc/init/fake-container-events.conf
10
+
11
+ # undo some leet hax of the base image
12
+ RUN rm /usr/sbin/policy-rc.d; \
13
+ rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl
14
+
15
+ # generate a nice UTF-8 locale for our use
16
+ RUN locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8
17
+
18
+ # remove some pointless services
19
+ RUN /usr/sbin/update-rc.d -f ondemand remove; \
20
+ for f in \
21
+ /etc/init/u*.conf \
22
+ /etc/init/mounted-dev.conf \
23
+ /etc/init/mounted-proc.conf \
24
+ /etc/init/mounted-run.conf \
25
+ /etc/init/mounted-tmp.conf \
26
+ /etc/init/mounted-var.conf \
27
+ /etc/init/hostname.conf \
28
+ /etc/init/networking.conf \
29
+ /etc/init/tty*.conf \
30
+ /etc/init/plymouth*.conf \
31
+ /etc/init/hwclock*.conf \
32
+ /etc/init/module*.conf\
33
+ ; do \
34
+ dpkg-divert --local --rename --add "$f"; \
35
+ done; \
36
+ echo '# /lib/init/fstab: cleared out for bare-bones Docker' > /lib/init/fstab
37
+
38
+ # small fix for SSH in 13.10 (that's harmless everywhere else)
39
+ RUN sed -ri 's/^session\s+required\s+pam_loginuid.so$/session optional pam_loginuid.so/' /etc/pam.d/sshd
40
+
41
+ RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
42
+
43
+ # let Upstart know it's in a container
44
+ ENV container docker
45
+
46
+ # set a cheap, simple password for great convenience
47
+ RUN echo 'root:docker.io' | chpasswd
48
+
49
+ # we can has SSH
50
+ EXPOSE 22
51
+
52
+ # pepare for takeoff
53
+ CMD ["/sbin/init"]
0 commit comments