weaveworks / footloose

Container Machines - Containers that look like Virtual Machines
Apache License 2.0
1.59k stars 122 forks source link

Image for SUSE / Tumbleweed #122

Open alexellis opened 5 years ago

alexellis commented 5 years ago

Hi @dlespiau,

I'd like to add an image for SUSE / Tumbleweed. I have the Dockerfile, would you accept a PR and build it through your CI process?

This is what I built - it is a combination of https://github.com/openSUSE/docker-containers/tree/master/derived_images/systemd and your examples for the other images.

FROM opensuse/tumbleweed:latest

RUN zypper -n install systemd; zypper clean ; \
(cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /usr/lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /usr/lib/systemd/system/local-fs.target.wants/*; \
rm -f /usr/lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /usr/lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /usr/lib/systemd/system/basic.target.wants/*;\
rm -f /usr/lib/systemd/system/anaconda.target.wants/*;

RUN zypper --non-interactive install \
  openssh \
  sudo hostname iproute2 net-tools iputils wget

RUN ln -s /bin/systemd /sbin/init
EXPOSE 22

# https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/
STOPSIGNAL SIGRTMIN+3

CMD ["bash"]

Output from the above:

[alex@nuc footloose]$ cat footloose.yaml 
cluster:
  name: cluster
  privateKey: cluster-key
machines:
- count: 1
  spec:
    image: suse:systemd 
    name: node%d
    portMappings:
    - containerPort: 22
      hostPort: 2222
[alex@nuc footloose]$ 
[alex@nuc footloose]$ footloose create
INFO[0000] Image: suse:systemd present locally          
INFO[0000] Creating machine: cluster-node0 ...          
[alex@nuc footloose]$ 
[alex@nuc footloose]$ footloose ssh root@node0
Have a lot of fun...
node0:~ # cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20190403"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20190403"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20190403"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
node0:~ # 

Let me know your thoughts.

Alex

alexellis commented 5 years ago

cc @feri

feri commented 5 years ago

@alexellis +1

dlespiau commented 5 years ago

Note that the quay.io/footloose images aren't currently updated and pushed regularly, just when PRs are merged into master. So not sure Tumbleweed is the right choice here (vs Leap). That said we should probably have a CI cronjob pushing footloose images regularly.

In any case, you should be able to open a PR with the new image:

dlespiau commented 5 years ago

you should probably add a zypper clean in your second RUN command.

alexellis commented 5 years ago

Thank you @dlespiau I'll go ahead and attempt that. Let me know if there are other changes or paperwork needed.