首先欣賞一下Red Hat與Docker團隊間的撕逼,http://www.open-open.com/news/view/117a7d2 從這個帖子看出來Centos7.1.1053版本的docker鏡像是木有systemd的,so,在網上找到另外一個帖子,http://www.tuicool.com/articles/6RRvQbi ,參考其給出的辦法。docker
1. docker pull centos:7.1.1053 拉取一個7.1.1053版本的docker鏡像centos
2. 本身寫一個Dockerfilesocket
# cat Dockerfile FROM centos:7.1.1503 MAINTAINER "you" <your@email.here> ENV container docker RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs 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/*;
3. 執行下面的命令作版本ui
docker build --rm -t centos7.1-systemd .
4. docker runcentos7