Skip to content

Instantly share code, notes, and snippets.

@wrouesnel
Last active May 12, 2016 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wrouesnel/f8f295f1e785cee2e31e4ac74cdfa396 to your computer and use it in GitHub Desktop.
Save wrouesnel/f8f295f1e785cee2e31e4ac74cdfa396 to your computer and use it in GitHub Desktop.
Centos7 and naked docker
[Match]
Name=en*
[Network]
DHCP=yes
#!/bin/bash
docker build --build-arg=http_proxy=http://172.17.0.1:3128 \
--build-arg=https_proxy=http://172.17.0.1:3128 -t zbi/centos7 dockerfile
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
EnvironmentFile=-/etc/default/docker
ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:2375 \
--storage-driver overlay \
--cluster-store etcd://localhost:2379 \
--log-driver journald
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
FROM centos:7
RUN echo 'filesystems+="ext4"' > /etc/dracut.conf.d/supported_filesystems.conf
RUN yum update -y && \
yum install -y kernel ca-certificates \
systemd-networkd systemd-resolved
RUN update-ca-trust
# Provision the basic image
COPY docker.repo /etc/yum.repos.d/docker.repo
RUN yum install -y docker-engine
COPY docker.service /etc/systemd/system/docker.service
RUN ln -sf /etc/systemd/system/docker.service \
/etc/systemd/system/multi-user.target.wants/docker.service
RUN ln -sf /lib/systemd/system/systemd-networkd.service /etc/systemd/system/multi-user.target.wants/systemd-networkd.service ; \
ln -sf /lib/systemd/system/systemd-resolved.service /etc/systemd/system/multi-user.target.wants/systemd-resolved.service
COPY all.network /etc/systemd/network/all.network
# Debian/Ubuntu add these by default, RedHat do not.
RUN ln -sf /boot/$(ls /boot | grep vmlinuz) /vmlinuz && \
ln -sf /boot/$(ls /boot | grep initramfs) /initrd.img
RUN echo "root:guest" | chpasswd
# Enforce SELinux relabelling on first boot
RUN touch /.autorelabel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment