https://hub.docker.com/_/centos/ docker
docker pull centos:6
centos
docker pull centos:6.6app
yum:
socket
註釋掉 /etc/yum.conf 中tsflags=modocs,重裝包ide
systemd for centos 7系ui
#systemd 包含在centos:7和centos:latest中,默認沒有激活spa
Dockerfile for sytemd base p_w_picpath
orm
FROM centos:7 MAINTAINER "you" <your@email.here> ENV container docker RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ rm -f /lib/systemd/system/basic.target.wants/*;\ rm -f /lib/systemd/system/anaconda.target.wants/*; VOLUME [ "/sys/fs/cgroup" ] CMD ["/usr/sbin/init"]get
docker build --rm -t local/c7-systemd .it
systemd enabled app container
FROM local/c7-systemd RUN yum -y install httpd; yum clean all; systemctl enable httpd.service EXPOSE 80 CMD ["/usr/sbin/init"]
$ docker build --rm -t local/c7-systemd-httpd
run a systemd enabled container
In order to run a container with systemd, you will need to mount the cgroups volumes from the host. Below is an example command that will run the systemd enabled httpd container created earlier.
$ docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 local/c7-systemd-httpd